-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useObserve trait value stays undefined when used with world #13
Comments
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)The text was updated successfully, but these errors were encountered: