feat(resources): remember list preferences - #7371
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@cubic-dev-ai please review this pull request. |
@j15z I have started the AI code review. It will take a few minutes to complete. |
Greptile SummaryThe PR remembers Files, Tables, and Knowledge list preferences per workspace while preserving URL state as the authoritative source.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/hooks/use-resource-list-preferences.ts | Reconciles persisted preferences with URL-owned list state and now preserves the authority of explicitly supplied default-valued parameters. |
| apps/sim/stores/resource-list-preferences/store.ts | Adds workspace- and module-scoped persistence with hydration recovery, validation, and user-data reset integration. |
| apps/sim/app/workspace/[workspaceId]/files/files.tsx | Routes Files filter and sort gestures through remembered preferences and gates list rendering until reconciliation completes. |
| apps/sim/app/workspace/[workspaceId]/tables/tables.tsx | Integrates remembered list preferences and readiness gating into the Tables resource list. |
| apps/sim/app/workspace/[workspaceId]/knowledge/knowledge.tsx | Integrates remembered list preferences and readiness gating into the Knowledge resource list. |
| apps/sim/app/workspace/[workspaceId]/files/search-params.ts | Defines a const-asserted Files preference configuration that reuses the uploaded-by URL alias. |
| apps/sim/hooks/use-resource-list-preferences.test.tsx | Covers hydration, restoration, explicit URL authority, complete snapshots, invalid storage, disabled mode, and preference commits. |
Reviews (2): Last reviewed commit: "fix(resources): harden list preference c..." | Re-trigger Greptile
There was a problem hiding this comment.
2 issues found across 14 files
Confidence score: 3/5
- In
apps/sim/hooks/use-resource-list-preferences.ts, explicit default-valued URL preferences can be mistaken for omitted parameters, allowing saved state to override a deep link and showing the wrong list configuration—track which preference keys were explicitly supplied before reconciling state. - In
apps/sim/hooks/use-resource-list-preferences.ts, a URL change during restoration can leave the stale snapshot active and keepisReadyfalse unless the old preference returns, potentially leaving the list stuck—cancel or invalidate the pending restoration when the URL becomes authoritative.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/sim/hooks/use-resource-list-preferences.ts">
<violation number="1" location="apps/sim/hooks/use-resource-list-preferences.ts:125">
P2: When the URL changes while restoration is pending, this branch returns without cancelling the stale snapshot. `isReady` then stays false unless the old preference eventually reappears; handle an authoritative URL change so the list becomes ready instead of remaining on its loading screen.</violation>
<violation number="2" location="apps/sim/hooks/use-resource-list-preferences.ts:145">
P1: Preserve whether the URL explicitly supplied list-preference keys before reconciling saved state. With default-valued nuqs parsers, an explicit default deep link produces the same `currentPreference` as an omitted parameter, so this reconciliation restores a saved non-default snapshot and overrides the link.</violation>
</file>
Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.
Fix all with cubic | Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 14 files
Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.
Requires human review: Auto-approval blocked by 2 unresolved issues from a previous review of this commit.
Fix all with cubic | Re-trigger cubic
|
@j15z I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 14 files
Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.
Fix all with cubic | Re-trigger cubic
Summary
Type of Change
Testing
bun run test -- hooks/use-resource-list-preferences.test.tsx stores/resource-list-preferences/store.test.tsfromapps/sim(33 tests)bun run lintbun run lint:checkbun run check:audits(44 audits)bun run apps/sim/scripts/check-block-registry.ts origin/stagingbun run check:zustand-v5bun run check:api-validationPost-Deploy Monitoring & Validation
Checklist