-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
[Blocks] Make it possible to have lazy initialized and lazy loaded Blocks #18220
Conversation
Blocks now initialize lazily.
This is for the case when it's a new Block that hasn't yet initialized. We need to first initialize it to see what "render function" it resolves to so that we can use that in our comparison.
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 db9c751:
|
Details of bundled changes.Comparing: fa03206...db9c751 react-dom
react-art
react-reconciler
ReactDOM: size: 0.0%, gzip: 🔺+0.1% Size changes (experimental) |
Details of bundled changes.Comparing: fa03206...db9c751 react-dom
react-art
ReactDOM: size: 0.0%, gzip: 0.0% Size changes (stable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of subtle that _fn gets a different meaning and you need to remember to call initialise.
The changing of The initialization is unfortunate. There's a lot going on here. We can't throw in child fiber atm because that would bubble to the wrong parent potentially. We would also prevent siblings from warming up. I'm also not happy with the extra tuples created or the "if thennable" type check. It took me like a month to get to this point and I'm still not happy with it. :) |
This builds on a similar design as Lazy in #18217
The goal here is to make evaluating the query lazy but still allow render functions from different sources to reconcile against each other - even if they're lazy. In my first approach I hid the lazy loading into the "render" function wrapper which is not going to work since it doesn't reconcile against the same thing anymore then.