Fix #1685 #1686
Closed
Jaime02(GitHub profile, opens in a new tab)wants to merge 1 commit into
main fromrefs/pull/1686/head·opened 🎯 Changes#
Fix #1685 issue report
✅ Checklist#
- I have tested this code locally with
pnpm test.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
Summary by CodeRabbit#
- Bug Fixes
- Fixed nested include results being inconsistently displayed when multiple parent records share related records.
- Deeply nested related data now remains available for every applicable parent record.
- Improved reliability when resolving multi-level relationships and shared nested records.
- 1
🧹 Nitpick comments (1)
packages/db/src/query/live/collection-config-builder.ts (1)
1877-1882: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAvoid using
anytypes; useunknowninstead.As per coding guidelines, avoid using
anytypes and useunknowninstead when the type is truly unknown. Consider updating the generic type of theSetto useunknownfor improved type strictness.♻️ Proposed fix
- routingCleanup?: Set<Record<PropertyKey, any>>, + routingCleanup?: Set<Record<PropertyKey, unknown>>, ): void { // The outermost call owns the cleanup set; nested calls inherit it so the // stamp survives until every parent group has been flushed. const isOutermostCall = routingCleanup === undefined - const cleanup = routingCleanup ?? new Set<Record<PropertyKey, any>>() + const cleanup = routingCleanup ?? new Set<Record<PropertyKey, unknown>>()🤖 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/db/src/query/live/collection-config-builder.ts` around lines 1877 - 1882, Update the routingCleanup parameter and the local cleanup Set in the surrounding function to use unknown instead of any for the Record value type, preserving the existing cleanup ownership and inheritance behavior.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. Nitpick comments: In `@packages/db/src/query/live/collection-config-builder.ts`: - Around line 1877-1882: Update the routingCleanup parameter and the local cleanup Set in the surrounding function to use unknown instead of any for the Record value type, preserving the existing cleanup ownership and inheritance behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
8a781add-4e64-44ee-977e-7a2de9741f9e📥 Commits
Reviewing files that changed from the base of the PR and between 7f0fa36ff6d48b0494ed5f6a1223fd18c317e41f and a633baaaf584dd5705bfbf548155b4114b9697c2.
📒 Files selected for processing (2)
packages/db/src/query/live/collection-config-builder.tspackages/db/tests/query/includes.test.ts
Already fixed! 😄
Jaime02(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
📝 Walkthrough
Walkthrough#
The change shares
INCLUDES_ROUTINGcleanup across recursive include flushes and defers stamp deletion until the outermost pass. A regression test covers two roots reaching shared nested rows and verifies that the deepest materialized leaf remains available for both.Changes#
Nested include flush
packages/db/src/query/live/collection-config-builder.tsflushIncludesStatepropagates a shared cleanup set through recursive calls and removesINCLUDES_ROUTINGstamps after the outermost flush completes.packages/db/tests/query/includes.test.tsEstimated code review effort: 3 (Moderate) | ~20 minutes
Possibly related issues
collection-config-builder.ts.Possibly related PRs
Suggested reviewers:
kevin-dp,kyleamathews,samwillis🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
✅ Passed checks (4 passed)
#1685by preserving nested routing state so shared middle rows keep their leaf materialization.✨ 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.
❤️ Share