Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
What
Fixes #1706. Notify change handlers once for a handled action, even when React reruns the shared reducer effect.
Why
With controlled values, the effect compares the controlled previous state with the raw reducer state. Re-running the effect for the same action can therefore repeat
onSelectedItemChangeand navigation or submission side effects when an Activity subtree is revealed. React 18 event rebasing can trigger the same mismatch.How
Remember the last handled action in a ref and mark it before calling change handlers. Keep updating the previous-state ref as before. A new dispatch still notifies, including when the caller reuses its action object or changes callbacks.
Changes
useEnhancedReducer.Verification
useSelect: React 18 same-frame move/click calls the handler once; React 19 Activity reveals with and without StrictMode do not replay it, while subsequent selections still notify.jest/unbound-methodplugin crash (services.getSymbolAtLocation is not a function) on the unchanged mock at the top of the test file; confirmed using the upstream file through stdin. All other changed-file lint rules pass with that one rule omitted for the local check. No lint configuration or dependencies are changed in this PR.Checklist
AI assistance was used to prepare the fix and regression. The failure was reproduced before the change and verified locally against source and built APIs.