Uh oh!
There was an error while loading. Please reload this page.
feat(experimental_createQueryPersister): removeItem if deserialize fails - #10190
Conversation
🦋 Changeset detectedLatest commit: 2875eb1 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 2875eb1
☁️ 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)
📝 WalkthroughWalkthroughWraps deserialization in try/catch across persister flows; on deserialize failure the storage entry is removed. Adds a changeset noting the behavior ("removeItem if deserialize fails") for a patch release of Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
🎯 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