Repository navigation
🐛 Fix lost writes and failed loads in the storage adapters - #245
Merged
Merged
Conversation
`JSON.parse` threw in the `getItem` of both adapters, and `persistSignals` then stopped the entry. So `isHydrated` stayed `false` and the signal was never persisted again. The bad value stayed in storage, and every reload stopped at the same point. Both adapters now read such a value as `undefined`, which the hydration already treats as "nothing stored". Closes #236. Claude-Session: https://claude.ai/code/session_01BvSDyJABLGit75HAjpnsqm
`createLocalStorageAdapter({ key })` keeps all signals in one entry.
Each call read the entry, waited, then wrote a changed copy. A second
call read the same old entry during that wait, so the last write won.
Two persisted signals that changed in the same handler lost one value.
Each call now reads and writes the entry synchronously, with no
`await` in between.
Closes #233.
Claude-Session: https://claude.ai/code/session_01BvSDyJABLGit75HAjpnsqm
mbret
marked this pull request as ready for review
November 3, 2026 23:25
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Why
With
createLocalStorageAdapter({ key }), two persisted signals that change in the same handler keep only the last write. The other value is lost without an error.A stored value that is not JSON stops the hydration at every load.
isHydratedstaysfalse, and nothing is persisted after that.awaitin between.What's new
Other changes
Details
getItemusesObject.hasOwn, so a key such asconstructorno longer returns a function from the object's prototype.🔍 Self-reviewed with selfcorrect-review
🤖 Made within harness coverage
Generated by Claude Code