Skip to content
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

Merged
merged 2 commits into from
Oct 7, 2019

Conversation

acdlite
Copy link
Collaborator

@acdlite acdlite commented Oct 7, 2019

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.

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.
@sebmarkbage
Copy link
Collaborator

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 {
Copy link
Collaborator Author

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.

@sizebot
Copy link

sizebot commented Oct 7, 2019

Details of bundled changes.

Comparing: cd1b167...e4b21be

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.profiling.min.js -1.9% -1.6% 121.79 KB 119.48 KB 38.33 KB 37.72 KB NODE_PROFILING
ReactDOM-dev.js -0.8% -0.8% 979.18 KB 971.52 KB 217.24 KB 215.56 KB FB_WWW_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.1% 1.2 KB 1.2 KB 700 B 701 B UMD_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.2% 1.04 KB 1.04 KB 631 B 632 B NODE_PROD
react-dom.development.js -0.8% -0.7% 954.69 KB 947.27 KB 216.02 KB 214.43 KB UMD_DEV
react-dom.production.min.js -2.0% -2.0% 118.02 KB 115.72 KB 37.99 KB 37.24 KB UMD_PROD
react-dom.profiling.min.js -1.9% -1.7% 121.54 KB 119.24 KB 39 KB 38.35 KB UMD_PROFILING
react-dom.development.js -0.8% -0.7% 948.76 KB 941.34 KB 214.46 KB 212.86 KB NODE_DEV
react-dom.production.min.js -2.0% -1.6% 118.14 KB 115.84 KB 37.31 KB 36.7 KB NODE_PROD
ReactDOM-prod.js -1.2% -1.3% 400.94 KB 395.96 KB 73.13 KB 72.18 KB FB_WWW_PROD
ReactDOM-profiling.js -1.2% -1.3% 401.75 KB 396.78 KB 73.64 KB 72.7 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.53 KB 60.53 KB 15.84 KB 15.84 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 10.75 KB 10.75 KB 3.67 KB 3.67 KB UMD_PROD
ReactDOMServer-prod.js 0.0% -0.0% 48.24 KB 48.24 KB 11.04 KB 11.04 KB FB_WWW_PROD
react-dom-unstable-native-dependencies.production.min.js 0.0% -0.0% 10.49 KB 10.49 KB 3.57 KB 3.57 KB NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js -0.2% -0.2% 669.26 KB 667.66 KB 145.53 KB 145.21 KB UMD_DEV
react-art.production.min.js -0.2% -0.3% 103.87 KB 103.65 KB 31.61 KB 31.52 KB UMD_PROD
react-art.development.js -0.3% -0.3% 599.89 KB 598.29 KB 128.12 KB 127.79 KB NODE_DEV
react-art.production.min.js -0.3% -0.3% 68.89 KB 68.67 KB 20.89 KB 20.82 KB NODE_PROD
ReactART-dev.js -0.3% -0.3% 614.61 KB 612.92 KB 127.95 KB 127.59 KB FB_WWW_DEV
ReactART-prod.js -0.3% -0.3% 231.35 KB 230.59 KB 39.07 KB 38.94 KB FB_WWW_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-prod.js -0.3% -0.3% 276.06 KB 275.3 KB 47.18 KB 47.04 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js -0.3% -0.2% 285.59 KB 284.84 KB 48.9 KB 48.78 KB RN_OSS_PROFILING
ReactFabric-prod.js -0.3% -0.3% 267.27 KB 266.52 KB 45.77 KB 45.64 KB RN_OSS_PROD
ReactFabric-profiling.js -0.3% -0.3% 277.92 KB 277.17 KB 47.64 KB 47.5 KB RN_OSS_PROFILING
ReactFabric-dev.js -0.2% -0.2% 751.5 KB 749.81 KB 159.06 KB 158.71 KB RN_FB_DEV
ReactFabric-prod.js -0.3% -0.3% 267.28 KB 266.52 KB 45.78 KB 45.65 KB RN_FB_PROD
ReactNativeRenderer-dev.js -0.2% -0.2% 747.02 KB 745.33 KB 158.36 KB 158 KB RN_OSS_DEV
ReactFabric-profiling.js -0.3% -0.3% 277.92 KB 277.16 KB 47.65 KB 47.51 KB RN_FB_PROFILING
ReactNativeRenderer-dev.js -0.2% -0.2% 747.18 KB 745.49 KB 158.43 KB 158.07 KB RN_FB_DEV
ReactNativeRenderer-prod.js -0.3% -0.3% 276.05 KB 275.3 KB 47.19 KB 47.05 KB RN_FB_PROD
ReactNativeRenderer-profiling.js -0.3% -0.2% 285.58 KB 284.83 KB 48.91 KB 48.79 KB RN_FB_PROFILING
ReactFabric-dev.js -0.2% -0.2% 751.33 KB 749.64 KB 158.98 KB 158.63 KB RN_OSS_DEV

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactTestRenderer-dev.js -0.3% -0.3% 625.89 KB 624.2 KB 130.38 KB 130.03 KB FB_WWW_DEV
react-test-renderer-shallow.development.js 0.0% 0.0% 38.96 KB 38.96 KB 9.93 KB 9.94 KB UMD_DEV
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.45 KB 11.45 KB 3.54 KB 3.54 KB UMD_PROD
react-test-renderer.development.js -0.3% -0.3% 613.45 KB 611.85 KB 130.95 KB 130.62 KB UMD_DEV
react-test-renderer.production.min.js -0.3% -0.2% 70.82 KB 70.6 KB 21.68 KB 21.62 KB UMD_PROD
react-test-renderer.development.js -0.3% -0.2% 608.72 KB 607.12 KB 129.76 KB 129.43 KB NODE_DEV
react-test-renderer.production.min.js -0.3% -0.3% 70.52 KB 70.3 KB 21.37 KB 21.3 KB NODE_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js -0.4% -0.4% 601.81 KB 599.47 KB 127.49 KB 127 KB NODE_DEV
react-reconciler.production.min.js -0.6% -0.7% 71.82 KB 71.42 KB 21.26 KB 21.12 KB NODE_PROD
react-reconciler-persistent.development.js -0.4% -0.4% 598.99 KB 596.65 KB 126.3 KB 125.81 KB NODE_DEV
react-reconciler-persistent.production.min.js -0.6% -0.7% 71.83 KB 71.43 KB 21.27 KB 21.12 KB NODE_PROD

react-noop-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-noop-renderer-persistent.development.js -2.4% -2.3% 35.86 KB 35 KB 8.17 KB 7.99 KB NODE_DEV
react-noop-renderer-persistent.production.min.js -3.6% -3.3% 12.22 KB 11.78 KB 3.88 KB 3.75 KB NODE_PROD
react-noop-renderer.development.js -2.4% -2.3% 35.74 KB 34.89 KB 8.16 KB 7.97 KB NODE_DEV
react-noop-renderer.production.min.js -3.6% -3.4% 12.2 KB 11.76 KB 3.87 KB 3.74 KB NODE_PROD

Generated by 🚫 dangerJS against e4b21be

@acdlite
Copy link
Collaborator Author

acdlite commented Oct 7, 2019

Are there any complexities in the workloop that can be simplified by removing this feature?

Most of them were in ReactFiberReconciler.js and ReactDOM.js. Though I now see I can also delete computeUniqueAsyncExpirationTime. I'll go through again and see if there's anything else.

@sebmarkbage
Copy link
Collaborator

sebmarkbage commented Oct 7, 2019

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.

@acdlite
Copy link
Collaborator Author

acdlite commented Oct 7, 2019

@sebmarkbage Any reason attemptSynchronousHydration is in the reconciler? If I move that to the work loop, I can get rid of flushRoot.

@sebmarkbage
Copy link
Collaborator

sebmarkbage commented Oct 7, 2019

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.

@sebmarkbage
Copy link
Collaborator

You can maybe simplify flushRoot though to something simpler.

@acdlite
Copy link
Collaborator Author

acdlite commented Oct 7, 2019

Ok I'll rename it and remove the invariant

@acdlite acdlite merged commit 71d012e into facebook:master Oct 7, 2019
@gaearon gaearon mentioned this pull request Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants