FIX solid-db, db: bug with solid not remounting with current data due to proxy issues#1608
FIX solid-db, db: bug with solid not remounting with current data due to proxy issues#1608fezproof wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughA two-line guard is added to ChangesNon-enumerable symbol clone fix and remount regression tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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
🧹 Nitpick comments (1)
packages/solid-db/tests/useLiveQuery.test.tsx (1)
2599-2704: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winExtract duplicated remount test scaffolding into a helper.
Both tests repeat the same collection setup, updater, mount/unmount, and assertion flow. Pulling this into a focused helper will reduce drift and make future remount regressions easier to cover.
Refactor sketch
+function setupDeepNodeRemountTest(singleResult: boolean) { + const nodeId = 'node-1' + const collection = createCollection( + mockSyncCollectionOptions<DeepNode>({ + id: singleResult ? 'remount-single-nested-test' : 'remount-array-nested-test', + getKey: (item) => item.id, + initialData: [{ id: nodeId, size: { min: 1, max: 10 } }], + }), + ) + const updateMax = (max: number) => { + collection.update(nodeId, (draft) => { + draft.size.max = max + }) + } + return { nodeId, collection, updateMax } +}As per coding guidelines, "Extract common logic into utility functions when identical or near-identical code blocks appear in multiple places" and "Prefer small, focused utility functions over large inline implementations."
🤖 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 2599 - 2704, Both the 'single-row reflects the current value on remount' and 'array reflects the current value on remount' tests contain nearly identical collection setup, updateMax function, mount logic, and assertion patterns. Extract the common test scaffolding into a reusable helper function that accepts a callback parameter to handle the differences between the two tests (specifically how the query is constructed with findOne versus without, and how the result is accessed). This will eliminate the code duplication and make the tests more maintainable.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.
Inline comments:
In @.changeset/loose-flies-sell.md:
- Line 6: The release note in the changeset file needs improved formatting for
clarity. Apply hyphenation to compound adjectives by adding hyphens to "non
enumerable" and "non current". Additionally, apply proper product casing to
"solid store" to match standard product naming conventions. These changes will
improve the readability and professionalism of the changelog entry.
---
Nitpick comments:
In `@packages/solid-db/tests/useLiveQuery.test.tsx`:
- Around line 2599-2704: Both the 'single-row reflects the current value on
remount' and 'array reflects the current value on remount' tests contain nearly
identical collection setup, updateMax function, mount logic, and assertion
patterns. Extract the common test scaffolding into a reusable helper function
that accepts a callback parameter to handle the differences between the two
tests (specifically how the query is constructed with findOne versus without,
and how the result is accessed). This will eliminate the code duplication and
make the tests more maintainable.
🪄 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: 4c4da52f-328e-4135-b378-27cbab73e0c8
📒 Files selected for processing (4)
.changeset/loose-flies-sell.mdpackages/db/src/proxy.tspackages/db/tests/proxy.test.tspackages/solid-db/tests/useLiveQuery.test.tsx
| '@tanstack/db': patch | ||
| --- | ||
|
|
||
| Fixed a bug where cloning non enumerable properties causes solid store to get stuck in a non current state |
There was a problem hiding this comment.
Polish release note wording for clarity.
Use hyphenation and product casing for readability in changelog text.
Suggested edit
-Fixed a bug where cloning non enumerable properties causes solid store to get stuck in a non current state
+Fixed a bug where cloning non-enumerable properties causes the Solid store to get stuck in a non-current state.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Fixed a bug where cloning non enumerable properties causes solid store to get stuck in a non current state | |
| Fixed a bug where cloning non-enumerable properties causes the Solid store to get stuck in a non-current state. |
🧰 Tools
🪛 LanguageTool
[grammar] ~6-~6: Use a hyphen to join words.
Context: ...patch --- Fixed a bug where cloning non enumerable properties causes solid store...
(QB_NEW_EN_HYPHEN)
[grammar] ~6-~6: Use a hyphen to join words.
Context: ...causes solid store to get stuck in a non current state
(QB_NEW_EN_HYPHEN)
🤖 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 @.changeset/loose-flies-sell.md at line 6, The release note in the changeset
file needs improved formatting for clarity. Apply hyphenation to compound
adjectives by adding hyphens to "non enumerable" and "non current".
Additionally, apply proper product casing to "solid store" to match standard
product naming conventions. These changes will improve the readability and
professionalism of the changelog entry.
Source: Linters/SAST tools
🎯 Changes
Fixed a bug where cloning non enumerable properties causes solid to get stuck in an old state after mounting a query.
Tests have been added that check for the issue, and fail on the current upstream code.
This can be recreated in real life by using a keyed Show component that mounts a form, updating the data, then remounting the form. The data will show the correct value, but will revert when remounted. The data in the collection will be correct, but the ui will be out of sync.
✅ Checklist
pnpm test.🚀 Release Impact
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests