-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
Expose react reconciler #642
Conversation
I want use it too, i want to use createPortal |
Can someone give me an example why export reconciler is useful? How it is used in the code? |
I just want to understand the real use case with Created portal will be rendered into I am ok to merge the PR. Just looking to edicate my self and understand how this can be used to create demos, docs. |
My use case: import { KonvaRenderer } from 'react-konva'
import { unstable_batchedUpdates } from 'react-dom'
unstable_batchedUpdates(() =>
KonvaRenderer.batchedUpdates(() => {
// updates
}, null)
) My problem is:
C will be updated after A or B updates and they should be updated in certain order. Usually it's not a problem, cause React will batch updates nodes. But when I combine two react renderers, the one (ReactKonva) which was triggered update from outside data source, it's updates will not be batched performed. In my case, it performs like this: When A node changes, observer a、b and c triggered update. React Konva performed three updates: first A then B then C. Until now, everything went well . Then something changed, cause some user's operation, the B node was replaced by D:
In state manager, the new d observer was pushed into observer list, became: [a, c, d]. When A node changes, observer a、c and d were triggered. React Konva will perform three updates in an unexpected order: first A then C then D. So, I need to get the react-konva-renderer instance to manually execute see: React 17 does NOT batch outside event handlers Sorry for my poor English, did my best :p |
I have complex App, where ingame UI created in react-konva and binded as layers for WebXR layers. Our fronts create a dom-like api bassed ot konva elements as separated libs. react-dom for regula html app propblem that we should have a more plain tree for developing propose, and i want to use portals for attach nodes of React-konva outside. Tree will be:
I can't said what is app by NDA until official announce. |
Published as @tuoxiansp for batching I hope react v18 will introduce many changes here. Currently, Konva events are not batched. v18 should resolve that. @eXponenta that is very interesting. I will be REALLY good if you can create a very short sample with codesandbox that can demonstrate such use cases. It is interesting to see it in action. |
pmndrs/zustand#302 (comment)
Might be helpful with resolving zombie child problem.
I have deployed this modification to my app. neka.cc
It helps ensure some imperative code like
node.cache()
that was nested inuseEffect
to be executed in the same order that was declared by JSX.