Skip to content

fix(storage): clean up sync listeners and guard deferred hydration init - #1071

Open
devagrawal09 wants to merge 1 commit into
solidjs-community:nextfrom
devagrawal09:fix/storage-sync-cleanup
Open

devagrawal09 wants to merge 1 commit into
solidjs-community:nextfrom
devagrawal09:fix/storage-sync-cleanup

Conversation

@devagrawal09

@devagrawal09 devagrawal09 commented Oct 13, 2026 •

Copy link
Copy Markdown

Problem

  1. messageSync adds a message listener that is never removed, so disposed components keep receiving sync messages.
  2. With hydrated: true, the deferred initialization calls set(init) without checking unchanged, unlike the async path. A write made before the timer fires is overwritten: the signal reverts while storage keeps the user's value.

Fix

  • messageSync keeps its handler and removes it on cleanup.
  • The deferred initialization checks unchanged, and its timer is cleared on cleanup.
  • Cleanup is only registered when there is an owner, so ownerless usage is unchanged and produces no warnings.

Test

Added one regression to persisted.test.ts. It fails without either fix.

@changeset-bot

changeset-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2dfa8d5

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

This PR includes changesets to release 1 package
Name Type
@solid-primitives/storage 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

@netlify

netlify Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for solid-primitives-v2 ready!

Name Link
🔨 Latest commit 2dfa8d5
🔍 Latest deploy log https://app.netlify.com/projects/solid-primitives-v2/deploys/6acdaebe75491aadf8965713
😎 Deploy Preview https://deploy-preview-1071--solid-primitives-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9ee9cc6e-fff3-4e24-965d-795ad61b3fc0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devagrawal09
devagrawal09 force-pushed the fix/storage-sync-cleanup branch from 5e98ff0 to 2dfa8d5 Compare October 13, 2026 04:08

This branch has not been deployed

No deployments
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