-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[v9] experiment: create objects with container effects #2607
Conversation
Studying this some more, am I understanding correctly that this PR would move the instance class construction from the render phase to the commit phase? And in doing so would negate the concurrency benefits of allowing work to be sliced and yielded in the render phase? ie facebook/react#20271 (comment) Also, why is the object creation and mutation done on |
Yes, this intentionally opts out of concurrency and suspense; that is only useful for the virtualized instances rather than their (real) three.js counterparts. We use |
I have been testing this PR and it does what it says on the tin. My custom classes have side effects that run only once, even with a series of contrived and nested suspense. However, all children have stopped attaching. Only the top level |
I'll need to mirror react-ogl. It has the v9 architecture and does this without issue. |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit a83e06e:
|
Works beautifully now. I'll be testing with some complicated setups and see if anything breaks. Do you anticipate any problems I should look out for? |
Used to be that adding props to primitive worked, but with this PR it does not. I know it's an odd use case, but one that is used in Drei currently. const controls = useMemo(
() => new FlyControlsImpl(camera, explDomElement),
[camera, explDomElement]
);
return (
<primitive
object={controls}
args={[camera, explDomElement]}
movementSpeed={movementSpeed}
rollSpeed={rollSpeed}
dragToLook={dragToLook}
{...rest}
/>
); |
This reverts commit 5f376ce.
Continues #2378, follow-up to #2465.
Defers instance object creation to when the tree is being linked, avoiding duplication of constructor side-effects.