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

Rename AsyncMode -> ConcurrentMode #13732

Merged
merged 6 commits into from
Sep 26, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions packages/react-is/src/ReactIs.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,19 @@ export const StrictMode = REACT_STRICT_MODE_TYPE;

export {isValidElementType};

let hasWarnedAboutDeprecatedIsAsyncMode = false;

// AsyncMode should be deprecated
export function isAsyncMode(object: any) {
lowPriorityWarning(
false,
'The ReactIs.isAsyncMode() alias has been deprecated, ' +
'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__)

hasWarnedAboutDeprecatedIsAsyncMode = true;
lowPriorityWarning(
false,
'The ReactIs.isAsyncMode() alias has been deprecated, ' +
'and will be removed in React 17+. Update your code to use ' +
'ReactIs.isConcurrentMode() instead. It has the exact same API.',
);
}
return isConcurrentMode(object);
}
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?

Expand Down