-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Remove dormant createBatch experiment #17035
Remove dormant createBatch experiment #17035
Conversation
In a hybrid React app with multiple roots, `createBatch` is used to coordinate an update to a root with its imperative container. We've pivoted away from multi-root, hybrid React apps for now to focus on single root apps. This PR removes the API from the codebase. It's possible we'll add back some version of this feature in the future.
Are there any complexities in the workloop that can be simplified by removing this feature? |
@@ -418,64 +224,24 @@ function ReactRoot(container: DOMContainer, options: void | RootOptions) { | |||
ReactRoot.prototype.render = ReactSyncRoot.prototype.render = function( | |||
children: ReactNodeList, | |||
callback: ?() => mixed, | |||
): Work { |
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.
@sebmarkbage I also changed this to return nothing instead of a thenable. It still accepts a callback. I actually forgot that we supported both forms... I don't think this was intentional? Let's choose one, or neither. I don't have a preference; I went with the callback for now because it's the simpler implementation.
Details of bundled changes.Comparing: cd1b167...e4b21be react-dom
react-art
react-native-renderer
react-test-renderer
react-reconciler
react-noop-renderer
|
Most of them were in ReactFiberReconciler.js and ReactDOM.js. Though I now see I can also delete |
I believe some of the exports from ReactFiberReconciler aren’t used by any renderer so we can delete those too while you’re at it. Although hopefully they are dce in the build already. |
@sebmarkbage Any reason |
It’s called by a renderer so needs to be exported by the reconciler since that’s the public api. But you can in-line it one way or another. It’s in the reconciler because it also does changes to the retry time. Also the other hydration functions are there. Seemed like we didn’t want to bloat the work loop with too many concerns. |
You can maybe simplify flushRoot though to something simpler. |
Ok I'll rename it and remove the invariant |
In a hybrid React app with multiple roots,
createBatch
is used to coordinate an update to a root with its imperative container.We've pivoted away from multi-root, hybrid React apps for now to focus on single root apps.
This PR removes the API from the codebase. It's possible we'll add back some version of this feature in the future.