fix(solid-db): set key option to $key when calling reconcile - #1598
fix(solid-db): set key option to $key when calling reconcile#1598Leonabcd123 wants to merge 9 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough
ChangesuseLiveQuery reconciliation key fix
Estimated code review effort: 2 (Simple) | ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.changeset/solid-id-rendering.md:
- Line 5: The release note in the changeset file contains two typos that need
correction on line 5: the phrase "that that" appears as a duplicate word and
should be simplified to "that", and the word "reconcilation" is misspelled and
should be corrected to "reconciliation". Update the text to fix both instances
so the release note reads clearly and professionally.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e433e653-ee95-4104-8db2-eb84d69e6a44
📒 Files selected for processing (3)
.changeset/solid-id-rendering.mdpackages/solid-db/src/useLiveQuery.tspackages/solid-db/tests/useLiveQuery.test.tsx
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/solid-db/tests/useLiveQuery.test.tsx (1)
2609-2639:⚠️ Potential issue | 🟠 MajorWrap
useLiveQueryin a managed reactive root to avoid leaked subscriptions.This test directly instantiates
useLiveQuerywithout a reactive owner context. In Solid.js, effects and signals created byuseLiveQuerymust be disposed properly to prevent subscription leakage between tests. UserenderHook(the established pattern throughout this file) orcreateRootwith cleanup to ensure proper lifecycle management.Suggested fix
- const query = useLiveQuery((q) => - q - .from({ items: collection }) - .orderBy(({ items }) => items.name, `asc`), - ) + const rendered = renderHook(() => + useLiveQuery((q) => + q + .from({ items: collection }) + .orderBy(({ items }) => items.name, `asc`), + ), + ) await waitFor(() => { - expect(query.isReady).toBe(true) + expect(rendered.result.isReady).toBe(true) }) expect( - Array.from(query()).map((item) => item.name), + Array.from(rendered.result()).map((item) => item.name), ).toEqual([`Bob`, `Kevin`, `Stuart`]) collection.utils.begin() collection.utils.write({ type: `update`, value: { _id: `stuart1`, name: `Alvin`, }, }) collection.utils.commit() await waitFor(() => { expect( - Array.from(query()).map((item) => item.name), + Array.from(rendered.result()).map((item) => item.name), ).toEqual([`Alvin`, `Bob`, `Kevin`]) })🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/solid-db/tests/useLiveQuery.test.tsx` around lines 2609 - 2639, The test is directly calling useLiveQuery without a managed reactive root context, which can leak subscriptions between tests in Solid.js. Wrap the useLiveQuery call and all subsequent query operations in either renderHook (the established pattern used elsewhere in this test file) or createRoot with proper cleanup to ensure effects and signals are disposed correctly. This ensures the reactive context is properly initialized and cleaned up after the test completes, preventing subscription leakage.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@packages/solid-db/tests/useLiveQuery.test.tsx`:
- Around line 2609-2639: The test is directly calling useLiveQuery without a
managed reactive root context, which can leak subscriptions between tests in
Solid.js. Wrap the useLiveQuery call and all subsequent query operations in
either renderHook (the established pattern used elsewhere in this test file) or
createRoot with proper cleanup to ensure effects and signals are disposed
correctly. This ensures the reactive context is properly initialized and cleaned
up after the test completes, preventing subscription leakage.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c00179c5-f4e2-4a12-8731-4007dfcd934c
📒 Files selected for processing (1)
packages/solid-db/tests/useLiveQuery.test.tsx
✅ Action performedReviews resumed. |
Fixes #1524.
🎯 Changes
Add
keyoption when callingreconcilewhich is set to$key, which makes it so items are matched correctly even when theidproperty doesn't exist.✅ Checklist
pnpm test.🚀 Release Impact
Summary by CodeRabbit
Bug Fixes
Tests