Open Ctrlmonster opened 1 month ago
Can you clarify if this is a type or value issue?
The actual runtime value was undefined
Then no, my test and naive set up in an actual app both show it working. Can you reproduce it? Or tell me how to reproduce the issue?
Yeah I'll see if I can reproduce it in a csb tomorrow
This should reproduce it:
function SceneContainer() {
const world = useWorld();
useEffect(() => {
world.add(SomeTrait);
return () => world.remove(SomeTrait);
}, [world]);
return (
<Child />
)
}
function Child() {
const world = useWorld();
const traitSnap = useObserve(world, SomeTrait);
console.log(traitSnap); // <-- stays undefined until HMR or something else triggers another tree rerender
return null;
}
Can you verify if this issue still exists with the latest version? This exact set up works with my tests and I believe v0.1.5 fixed it.
Hey, didn't have the time yet to make a csb for this, but putting it down here so it doesn't get lost:
I had some issues with using
useObserve
with theworld
this morning, where the trait value would stay undefined, even though I knew it to exist. Can you double check that it works in one of your apps? (Otherwise I'll make a csb later on)