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

Context.Consumer unexpectedly updates each time one of its child components call setState #12218

Closed
jaredLunde opened this issue Feb 12, 2018 · 2 comments
Assignees

Comments

@jaredLunde
Copy link

Do you want to request a feature or report a bug?

  • Report a bug

What is the current behavior?

  • Each time a child component of Context.Consumer calls setState, its parent Context.Consumer re-renders.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:

What is the expected behavior?

  • Presumably the expected behavior is one where setting the state of a child component does not affect any parent Context.Consumer components, particularly when that state does not change

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

  • Versions
    • 16.3.0-alpha.1
    • 16.3.0-alpha.0
  • Browser
    • Chrome (OSX 10.13.3) 64.0.3282.140
  • This works as expected when the previous context API is used
@jaredLunde jaredLunde changed the title Context.Consumer unexpectedly updates each time a child component calls setState Context.Consumer unexpectedly updates each time one of its child components call setState Feb 12, 2018
@acdlite
Copy link
Collaborator

acdlite commented Feb 13, 2018

Woo hoo! Thanks for the incredibly detailed bug report! I know why this is happening and it's an easy fix. We'll get this working before the release.

@acdlite
Copy link
Collaborator

acdlite commented Mar 12, 2018

Closed by #12254

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants