Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rename AsyncMode -> ConcurrentMode #13732

Merged
merged 6 commits into from
Sep 26, 2018

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Sep 26, 2018

This PR renames AsyncMode to ConcurrentMode. Specifically:

  • React exports unstable_ConcurrentMode now rather than unstable_AsyncMode.
  • ReactTestRender now takes unstable_isConcurrent as an option rather than unstable_isAsync.
  • Many instances of isAsync have been renamed to isConcurrent to reflect the naming changes.
  • REACT_ASYNC_MODE_TYPE has been renamed to REACT_CONCURRENT_MODE_TYPE.
  • react-is now exports isConcurrentMode, renamed from isAsyncMode.
  • Tests have been updated to use the new naming scheme.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Run Prettier

Fix up

More renames
@sizebot
Copy link

sizebot commented Sep 26, 2018

Details of bundled changes.

Comparing: d0c0ec9...d02c8b8

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js 0.0% 0.0% 388.34 KB 388.45 KB 84.91 KB 84.92 KB UMD_DEV
react-test-renderer.production.min.js 0.0% -0.0% 51.23 KB 51.25 KB 15.6 KB 15.6 KB UMD_PROD
react-test-renderer.development.js 0.0% 0.0% 383.91 KB 384.02 KB 83.78 KB 83.8 KB NODE_DEV
react-test-renderer.production.min.js 0.0% -0.0% 50.95 KB 50.96 KB 15.43 KB 15.43 KB NODE_PROD
react-test-renderer-shallow.development.js +2.8% +3.0% 25.61 KB 26.32 KB 6.87 KB 7.07 KB UMD_DEV
react-test-renderer-shallow.production.min.js 🔺+0.1% 0.0% 7.16 KB 7.17 KB 2.35 KB 2.35 KB UMD_PROD
react-test-renderer-shallow.development.js +0.1% -0.0% 20.8 KB 20.82 KB 5.66 KB 5.66 KB NODE_DEV
react-test-renderer-shallow.production.min.js 🔺+0.1% 0.0% 7.89 KB 7.9 KB 2.61 KB 2.61 KB NODE_PROD
ReactTestRenderer-dev.js 0.0% 0.0% 387.68 KB 387.79 KB 82.5 KB 82.51 KB FB_WWW_DEV
ReactShallowRenderer-dev.js +0.1% -0.0% 17.85 KB 17.88 KB 4.68 KB 4.67 KB FB_WWW_DEV

react-is

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-is.development.js +52.4% +75.2% 4.72 KB 7.2 KB 1.3 KB 2.28 KB UMD_DEV
react-is.production.min.js 🔺+3.6% 🔺+2.4% 1.92 KB 1.99 KB 800 B 819 B UMD_PROD
react-is.development.js +54.5% +79.0% 4.54 KB 7.01 KB 1.24 KB 2.23 KB NODE_DEV
react-is.production.min.js 🔺+4.3% 🔺+3.1% 1.88 KB 1.96 KB 732 B 755 B NODE_PROD
ReactIs-dev.js +17.2% +19.7% 4.62 KB 5.42 KB 1.27 KB 1.52 KB FB_WWW_DEV
ReactIs-prod.js 🔺+6.3% 🔺+6.1% 3.73 KB 3.96 KB 1013 B 1.05 KB FB_WWW_PROD

scheduler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
scheduler.development.js n/a n/a 0 B 19.17 KB 0 B 5.74 KB UMD_DEV
scheduler.production.min.js n/a n/a 0 B 3.16 KB 0 B 1.53 KB UMD_PROD

Generated by 🚫 dangerJS

@@ -68,8 +68,8 @@ export const StrictMode = REACT_STRICT_MODE_TYPE;

export {isValidElementType};

export function isAsyncMode(object: any) {
return typeOf(object) === REACT_ASYNC_MODE_TYPE;
export function isConcurrentMode(object: any) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both this and symbol export rename would be a breaking change technically. Unfortunately we forgot the unstable prefix here. Let’s keep both and add a deprecation warning for isAsyncMode.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made the change. Did I do it correctly?

'and will be removed in React 17+. Update your code to use ' +
'ReactIs.isConcurrentMode() instead. It has the exact same API.',
);
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be inside if (__DEV__)

@trueadm trueadm merged commit 0dc0ddc into facebook:master Sep 26, 2018
@bvaughn
Copy link
Contributor

bvaughn commented Sep 26, 2018

Hey @trueadm. This change will require a corresponding change in react-devtools. Are you also going to own that?

@trueadm
Copy link
Contributor Author

trueadm commented Sep 26, 2018

@bvaughn Just found the comment. Sure!

@monkindey
Copy link
Contributor

Is it the breaking change?

@bvaughn
Copy link
Contributor

bvaughn commented Sep 28, 2018

No. Both async and concurrent modes are "unstable_" (e.g. React.unstable_AsyncMode) so they're expected to potentially change between minor releases.

@wheelo
Copy link

wheelo commented Oct 25, 2018

Are there any doc about the usage of this ConcurrentMode Mode?

@gaearon
Copy link
Collaborator

gaearon commented Oct 25, 2018

No — it's unstable. We only document stable features.

gaearon pushed a commit that referenced this pull request Oct 31, 2018
jetoneza pushed a commit to jetoneza/react that referenced this pull request Jan 23, 2019
* Rename AsyncMode -> ConcurrentMode
jetoneza pushed a commit to jetoneza/react that referenced this pull request Jan 23, 2019
NMinhNguyen referenced this pull request in enzymejs/react-shallow-renderer Jan 29, 2020
* Rename AsyncMode -> ConcurrentMode
@gaearon gaearon mentioned this pull request Mar 29, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants