-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Possible optimization to useSyncExternalStore's withSelector #24884
Comments
I will fix it please give me |
please assign me |
Next to the optimization mentioned, there is another issue this resolves: reduxjs/react-redux#1981 |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
Still worth looking at. |
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment! |
BUMP! |
Bump 🙏 |
👀 Bump |
bump |
1 similar comment
bump |
We kind of need this. I don't understand why this isn't baked in from the start. Just as |
It has been fixed in main so you can get the fix using:
|
react/packages/use-sync-external-store/src/useSyncExternalStoreWithSelector.js
Lines 70 to 91 in dd2d652
Hey, isn't line 89 in block above supposed to be right before line 78?
I mean, if
prevSnapshot
andnextSnapshot
are not equal, butprevSelection
andnextSelection
are equal, shouldn't we at least updatememoizedSnapshot
to be equal tonextSnapshot
?That way, in the next run of this callback, we at least don't run
selector
andisEqual
again.I may be missing something here, but I did make that change in our, pretty hefty, code base and all the tests passed and I got a nice performance boost.
The text was updated successfully, but these errors were encountered: