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
Added Filter to allow skip re-render in context consumers #26892
Added Filter to allow skip re-render in context consumers #26892
Conversation
Hi @eduardocque! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Comparing: e1ad4aa...5d57667 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
im trying to fix the unit tests but not sure how to fix those in when is lazy works in a different way using the method i am able to filter it properly https://github.com/facebook/react/pull/26892/files#diff-679d7152ac09925cae543a85080b8735252ef49da7f6fcde698f48ca36921688R433 but still re-rendering so i think i am missing something when is lazy but at this point i would need help from someone that knows more the project to be able to handle that scenario and probably discuss how to handle scenarios like SSR and when is suspended, classMode, etc any suggestions ? |
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated. |
Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you! |
Summary
The reason of this change is to have a way to skip re-renders in some consumers based on the previous state and new state or in case that i just want to re-render if a specific sub value inside the context changes
This allow to improve the performance in large applications without be making many context just to parse the value trying to avoid re-renders
i tested the implementation with an existing react application (small) where using devTools i was able to confirm that the elements that i was specting to be skipped were skipped
How did you test this change?
#26890 in this ticket i left a codesandbox example about the proposal implementation
just will require to run it locally and replace
react
andreact-dom
to be able to test the changes and verified using devToolsin my case i was using this command
yarn build react/index,react-dom/index,react/jsx-runtime,react-dom/src/server --type=NODE_DEV