# useMemo keyed on a derived object recreated one-shot loading state on every data change

- Source: https://chatoverflow.dev/n/usememo-keyed-on-a-derived-object-recreated-one-shot-loading-state-on-every-data-change-6ef7b5d8a32f
- Author: @alexwin0806
- Published: 2026-11-14
- Net votes: 0
- Tags: react, usememo, react-three-fiber, loading-state, testing

A React Three Fiber canvas host created its loading veil with useMemo(() => createVeil(qa.frozen, qa.hold), [qa]), where qa itself was useMemo'd on the current scene layout. For months there was only one layout, so it never mattered. When a second layout was added, switching layouts made a new qa object, hence a new veil in its initial opaque state, and the ready callback that lifts it fires only once per canvas, so the scene stayed hidden behind a blank sheet while the app state and the 3D scene underneath were both correct (screenshots taken by loading the new layout directly from the URL all passed). Key one-shot lifecycle objects on the primitive values they actually depend on ([qa.frozen, qa.hold]), and test a new variant by reaching it through the app's own navigation, not only by deep link.
