Skip to content

feat(resources): remember list preferences - #7371

Merged
j15z merged 4 commits into
stagingfrom
feat/remember-module-sort
Sep 2, 2026
Merged

feat(resources): remember list preferences#7371
j15z merged 4 commits into
stagingfrom
feat/remember-module-sort

Conversation

@j15z

@j15z j15z commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • remember Files, Tables, and Knowledge filter and sort preferences per workspace
  • restore saved preferences through URL state without rendering temporary defaults
  • treat any explicit filter or sort query parameter as authoritative, including parameters that resolve to module defaults
  • keep partial deep links complete and clear saved preferences on identity reset

Type of Change

  • Feature

Testing

  • bun run test -- hooks/use-resource-list-preferences.test.tsx stores/resource-list-preferences/store.test.ts from apps/sim (33 tests)
  • bun run lint
  • bun run lint:check
  • bun run check:audits (44 audits)
  • bun run apps/sim/scripts/check-block-registry.ts origin/staging
  • bun run check:zustand-v5
  • bun run check:api-validation
  • Known baseline: app type checking still reports unrelated existing errors in the Pi SDK and MySQL client

Post-Deploy Monitoring & Validation

  • No server logs or operational metrics are expected because this changes device-local list preference reconciliation only.
  • Smoke-test Files, Tables, and Knowledge: clean URLs restore saved preferences, while explicit default query parameters override and clear the saved preference.
  • Healthy behavior: each module becomes ready without a default-state flash, repeated URL writes, or a stuck loading state.
  • Roll back the latest fix commit if an explicit URL is overridden by storage or module loading remains blocked.
  • Validation window and owner: first post-deploy smoke test by the feature owner.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement

@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 2, 2026 12:03am UTC

Request Review

@j15z

j15z commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai please review this pull request.

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

@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-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR remembers Files, Tables, and Knowledge list preferences per workspace while preserving URL state as the authoritative source.

  • Adds a persisted Zustand store with hydration, validation, and identity-reset handling.
  • Adds a shared reconciliation hook for restoring and committing complete filter and sort snapshots.
  • Integrates readiness gating and preference-backed controls into all three resource lists.
  • Adds focused store and hook regression coverage, including explicit default-valued and aliased query parameters.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

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

Comment thread apps/sim/hooks/use-resource-list-preferences.ts
Comment thread apps/sim/app/workspace/[workspaceId]/files/search-params.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 keep isReady false 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

Comment thread apps/sim/hooks/use-resource-list-preferences.ts Outdated
Comment thread apps/sim/hooks/use-resource-list-preferences.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread apps/sim/app/workspace/[workspaceId]/files/files.tsx
@j15z

j15z commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai

@j15z I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread apps/sim/hooks/use-resource-list-preferences.test.tsx Outdated
@j15z

j15z commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

@greptile

@j15z
j15z merged commit 452e542 into staging Sep 2, 2026
26 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/remember-module-sort branch September 2, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant