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

Removed Root API callback params and added warnings #17916

Merged

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Jan 27, 2020

The goal is to prevent introducing new uses of the update queue callback behavior (so that we can deprecate it later, as part of cleaning up legacy class component usage), Fortunately it looks like we weren't using these params internally anywhere, so I've just added tests that verify the new warning behavior.

I based the wording of this warning on a similar warning for hooks:

function dispatchAction<S, A>(
fiber: Fiber,
queue: UpdateQueue<S, A>,
action: A,
) {
if (__DEV__) {
if (typeof arguments[3] === 'function') {
console.error(
"State updates from the useState() and useReducer() Hooks don't support the " +
'second callback argument. To execute a side effect after ' +
'rendering, declare it in the component body with useEffect().',
);
}
}

@bvaughn bvaughn force-pushed the deprecate-root-render-callback-param branch from 7d1fed5 to b64acb1 Compare January 27, 2020 19:52
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jan 27, 2020
@codesandbox-ci
Copy link

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 7d1fed5:

Sandbox Source
nameless-monad-552hh Configuration

@codesandbox-ci
Copy link

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 b64acb1:

Sandbox Source
late-sound-bdsxf Configuration

@sizebot
Copy link

sizebot commented Jan 27, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against b64acb1

@sizebot
Copy link

sizebot commented Jan 27, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against b64acb1

Copy link
Collaborator

@acdlite acdlite left a comment

Choose a reason for hiding this comment

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

Hmm, might want to bikeshed the warning message later. Don't have any specific suggestion though.

@bvaughn bvaughn merged commit e26682a into facebook:master Jan 27, 2020
@bvaughn bvaughn deleted the deprecate-root-render-callback-param branch January 27, 2020 20:35
@bvaughn
Copy link
Contributor Author

bvaughn commented Jan 27, 2020

Cool. Happy to tweak it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants