feat(experimental_createQueryPersister): removeItem if deserialize fails#10190
feat(experimental_createQueryPersister): removeItem if deserialize fails#10190rklomp wants to merge 4 commits intoTanStack:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 6e20934 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
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 |
|
View your CI Pipeline Execution ↗ for commit 6e20934
☁️ Nx Cloud last updated this comment at |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA changeset adds a minor release note for Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/query-persist-client-core/src/createPersister.ts`:
- Around line 251-259: The GC loop currently uses key.startsWith(prefix) and may
remove unrelated keys on deserialize failure; update the conditional to match
the delimited prefix used by restoreQueries (use `${prefix}-` or equivalent)
before attempting deserialize and potential storage.removeItem calls so only
intended persisted-query keys (in the entries iteration inside createPersister)
are deserialized and removed; locate the loop over entries, the
key.startsWith(prefix) check, the deserialize(...) call, and
storage.removeItem(...) and tighten the prefix match there.
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| '@tanstack/query-persist-client-core': minor | |||
There was a problem hiding this comment.
This should be a patch change
🎯 Changes
We can remove the item from storage if deserialize fails as its not usable anymore.
✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit