Skip to content

fix: ensure toStore subscription correctly syncs latest value #14015

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

Merged
merged 2 commits into from
Oct 30, 2024
Merged

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented Oct 29, 2024

Closes #14010. Whilst reading the store value with a console.log isn't guaranteed to be the latest value (as stores are subscriptions and effects run on microtasks) the template should definitely eventually get in sync, and from the example, it doesn't on initial render. This PR fixes that by checking if intermittent value changes during subscription.

Verified

This commit was signed with the committer’s verified signature.
RobinMalfait Robin Malfait
Copy link

changeset-bot bot commented Oct 29, 2024

🦋 Changeset detected

Latest commit: fcec745

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Oct 29, 2024

pnpm add https://pkg.pr.new/svelte@14015

commit: fcec745

Verified

This commit was signed with the committer’s verified signature.
RobinMalfait Robin Malfait
@trueadm trueadm merged commit 435a9c1 into main Oct 30, 2024
10 checks passed
@trueadm trueadm deleted the toStore-fix branch October 30, 2024 11:02
@github-actions github-actions bot mentioned this pull request Oct 30, 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.

store value is not displayed after update when created via toStore()
2 participants