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: Consider queued updates for initial state #360

Merged
merged 1 commit into from
Oct 4, 2023

Conversation

franky47
Copy link
Member

@franky47 franky47 commented Oct 4, 2023

This solves issues when a component is mounted by a state change, and which itself contains a hook on the key that caused it to mount.

Because the correct value is still in the queue at mount time, it won't be correctly set in the mounted component, and because internal history updates don't trigger a state sync, the newly mounted component won't re-render when the URL is updated.

Reproduction in the playground

Closes #359.

This solves issues when a component is mounted by
a state change, and which itself contains a hook on the
key that caused it to mount.

Because the correct value is still in the queue at mount time,
it won't be correctly set in the mounted component, and because
internal history updates don't trigger a state sync, the newly
mounted component won't re-render when the URL is updated.

Closes #359.
@vercel
Copy link

vercel bot commented Oct 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-usequerystate ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 4, 2023 7:28am

@franky47 franky47 merged commit e10c85c into next Oct 4, 2023
5 checks passed
@franky47 franky47 deleted the fix/359-initial-state-from-queue branch October 4, 2023 07:39
@github-actions
Copy link

github-actions bot commented Oct 4, 2023

🎉 This PR is included in version 1.8.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

return null for conditional component after setting value and need to trigger twice in order to work
1 participant