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

fix(react): restore useAtomSelector mounted state when swapping inline refs #108

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

bowheart
Copy link
Collaborator

Description

The new useAtomSelector implementation had a copy-paste error - when setting mounted to false temporarily while swapping out inline refs, the code never actually set it back to true, instead setting it to false again. This meant inline selectors would lose their subscription after the 2nd update (it would go: First render, first update, second render, swap ref and destroy subscription). No test cases and my simple testing never checked beyond the second render.

Add a regression test for this that makes sure inline selectors stay subscribed across four renders.

@bowheart bowheart merged commit 4f7fba6 into next/v1.3.x Jul 30, 2024
2 checks passed
@bowheart bowheart deleted the josh/restore-mounted branch July 30, 2024 18:54
bowheart added a commit that referenced this pull request Jul 30, 2024
bowheart added a commit that referenced this pull request Aug 31, 2024
bowheart added a commit that referenced this pull request Sep 5, 2024
bowheart added a commit that referenced this pull request Sep 8, 2024
bowheart added a commit that referenced this pull request Sep 16, 2024
bowheart added a commit that referenced this pull request Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant