Skip to content

improvement(url-state): platform-wide nuqs audit — migrate remaining view-state, codify conventions#5851

Merged
waleedlatif1 merged 8 commits into
stagingfrom
nuqs-ee-settings-migration
Jul 22, 2026
Merged

improvement(url-state): platform-wide nuqs audit — migrate remaining view-state, codify conventions#5851
waleedlatif1 merged 8 commits into
stagingfrom
nuqs-ee-settings-migration

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • full platform audit (landing, workspace, settings, ee) found the app surface clean except the ee settings sections and three stragglers — this PR migrates all of them so view-state is consistently deep-linkable via nuqs
  • ee sections: audit-logs filters get a co-located search-params.ts (?types=, ?time-range=, ?start-date=, ?end-date=, reusing the logs kebab-token time-range parser); access-control deep-links ?group-id=; custom-blocks deep-links ?custom-block-id= (create flow stays local); audit-logs/access-control/custom-blocks/data-drains/forks search binds the shared settings ?search= via useSettingsSearch() — deletes audit-logs' hand-rolled debounce effect
  • sweep stragglers: knowledge document chunk ?enabled= filter (page reset in the same write), workflow-mcp-servers ?server-tab= deep-link (cleared with the server id on close), byok provider search via a controlled prop pair (modal consumers keep local state)
  • correctness: detail views gate on the resolved entity (dead/loading ids fall back to the list); every deep-link opens with push and closes with replace; parseAsTimeRange parses unknown tokens to null so each surface's default applies
  • rule updates (.claude/rules/sim-url-state.md): shallow default, urlKeys kebab remapping, throttleMs deprecation, startTransition with shallow:false, shared-parser null-fallback, resolve-before-open, close-with-replace, reusable-component controlled search

Type of Change

  • Improvement

Testing

Typecheck, biome, lint:check, and 617 tests across the touched areas pass. Ran an adversarial review pass plus the full cleanup battery (effects/state/memo/callback/react-query/emcn/url-state/comments) — all findings fixed in-branch.

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 (CLA)

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 22, 2026 6:58pm

Request Review

@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Mostly client view-state and documentation; parser changes are defensive (null fallbacks, date validation) with no auth or data-path changes.

Overview
Finishes the nuqs migration for enterprise settings and a few remaining workspace surfaces so filters, search, and detail views are shareable via the URL, aligned with the rest of the app.

EE settings get co-located search-params.ts where needed (notably audit logs: types, time-range, start-date, end-date with kebab urlKeys, reusing logs parsers). List search on audit logs, access control, custom blocks, data drains, and forks now uses shared ?search= via useSettingsSearch() (audit logs drops a hand-rolled debounce effect). Deep links: ?group-id= (access control), ?custom-block-id= (create stays local), with detail opened only after the id resolves and close via history: 'replace'.

Workspace stragglers: knowledge document chunks gain ?enabled= (replacing local filter state; resets page in the same write); workflow MCP servers add ?server-tab= (cleared with mcpServerId on back); BYOK search is deep-linkable via optional controlled props on BYOKKeyManager.

Parser hygiene: shared parseAsTimeRange returns null for unknown tokens so logs vs audit logs can use different defaults; new parseAsDateString guards invalid custom-range dates. Comments across features point at useDebouncedSearchSetter instead of ad-hoc debounce wiring.

.claude/rules/sim-url-state.md extends to ee/** and documents nuqs v2 defaults, urlKeys remapping, resolve-before-open, close-with-replace, and reusable-component search patterns.

Reviewed by Cursor Bugbot for commit bc91f53. Configure here.

Comment thread apps/sim/ee/custom-blocks/components/custom-blocks.tsx
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR moves the remaining shareable view state to nuqs-backed URL parameters. The main changes are:

  • Adds deep-linkable filters, searches, tabs, and detail views across workspace and enterprise settings.
  • Adds shared audit-log parsers for time ranges, dates, and resource types.
  • Resets related pagination and detail state during URL updates.
  • Documents platform conventions for URL keys, history, defaults, and controlled search.

Confidence Score: 5/5

This looks safe to merge.

  • Custom ranges are used only when both date bounds are present.
  • Partial or invalid custom-range links fall back to the bounded default window.
  • List and export requests both use the guarded filter values.
  • No blocking issue remains in the reviewed fix.

Important Files Changed

Filename Overview
apps/sim/ee/audit-logs/components/audit-logs.tsx Moves audit-log filters into URL state and falls back to the default window when either custom bound is missing.
apps/sim/ee/audit-logs/search-params.ts Adds typed URL parsers and kebab-case mappings for audit-log filters.
apps/sim/app/workspace/[workspaceId]/logs/search-params.ts Makes unknown time-range tokens use each consumer's default and rejects unparseable date strings.

Reviews (5): Last reviewed commit: "fix(url-state): include permissions load..." | Re-trigger Greptile

Comment thread apps/sim/ee/audit-logs/components/audit-logs.tsx
@waleedlatif1 waleedlatif1 changed the title improvement(url-state): migrate ee settings sections to nuqs deep-linkable view-state improvement(url-state): platform-wide nuqs audit — migrate remaining view-state, codify conventions Jul 22, 2026
@waleedlatif1
waleedlatif1 force-pushed the nuqs-ee-settings-migration branch from 04f11a9 to 60a3d79 Compare July 22, 2026 18:33
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 60a3d79. Configure here.

…kable view-state

- audit-logs: types/time-range/start-date/end-date filters move to a co-located
  search-params.ts (reusing the logs kebab-token time-range parser); search binds
  to the shared settings ?search= via useSettingsSearch, replacing a hand-rolled
  debounce effect
- access-control: group detail deep-links via ?group-id (push/replace-on-close);
  search via useSettingsSearch
- custom-blocks: block detail deep-links via ?custom-block-id; create flow stays
  local; search via useSettingsSearch
- data-drains + forks: search via useSettingsSearch; forks close now replaces
  history like the mcp reference pattern
- polish: nullable-reason comment on logs startDate/endDate, stale debounce
  TSDoc now references useDebouncedSearchSetter
… opening detail, per-surface time-range fallback

- custom-blocks: gate the detail view on the resolved block (matching mcp/
  access-control), so a dead or still-loading ?custom-block-id no longer flashes
  a bogus create screen
- parseAsTimeRange: unknown tokens now parse to null so each surface's
  .withDefault applies (logs keeps 'All time'; audit-logs keeps 'Past 30 days'
  instead of silently widening to all time on a malformed link)
- audit-logs: date-picker cancel target can never be 'Custom range' itself on a
  dateless custom deep link
- refresh shared ?search= consumer lists in TSDoc
…view-state stragglers, codify conventions

Sweep across landing, workspace, and settings surfaces found only three
remaining candidates (everything else verified clean or correctly non-URL):

- knowledge document page: chunk enabled-status filter joins page/search/sort in
  the URL (?enabled=), resetting page in the same write
- workflow-mcp-servers: detail Details/Workflows tab deep-links via ?server-tab,
  cleared alongside the server id on close
- byok: provider search binds the shared settings ?search= via a controlled
  prop pair (modal/embedded consumers keep local state)

Rule updates (.claude/rules/sim-url-state.md): shallow defaults documented,
urlKeys kebab remapping, throttleMs deprecation, startTransition with
shallow:false, shared-parser null-fallback rule, resolve-before-open gating,
close-with-replace, and the reusable-component controlled-search pattern.
…activity view, TSDoc form for the logs nullable comment
…resent

A partial ?time-range=custom deep link (missing start/end) now falls back to
the default preset window instead of displaying 'Custom range' while querying
an unbounded result set.
…rams, tighten docs

- new parseAsDateString parser (logs + audit-logs): an unparseable
  ?start-date=/?end-date= now parses to null (missing bound) instead of
  crashing the audit-logs render via Invalid Date .toISOString(), and hardens
  the same class in logs
- audit-logs: remove the provably dead cancel-revert branch and its ref —
  the URL only holds 'Custom range' after Apply writes both bounds atomically
- workflow-mcp-servers: reset a lingering ?server-tab= when opening a server
  so a dead deep link can't re-target the next open
- knowledge document: drop the unreachable 'N selected' label branch
- sim-url-state.md fact-check corrections: cover apps/sim/ee in paths,
  focusedBlockId -> currentBlockId (the real store field), note that
  history/clearOnDefault are nuqs v2 defaults, fix the Suspense
  cross-reference and parseAsIsoDate serialize detail, clarify the *UrlKeys
  naming convention; list byok in the shared-search consumer docs
@waleedlatif1
waleedlatif1 force-pushed the nuqs-ee-settings-migration branch from 9b3e7fb to 03f1641 Compare July 22, 2026 18:45
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/ee/custom-blocks/components/custom-blocks.tsx
…till resolve

A valid ?custom-block-id= no longer flashes the list while the blocks query is
pending; a dead id still falls back to the list once loaded.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/ee/custom-blocks/components/custom-blocks.tsx
…link paint hold

canAdmin reads false while the permissions context loads, so the hold must
gate on permissionsLoading too; drop the blocksPending conjunct — it shares
one query with useCanPublishCustomBlock, so isLoading already covers it.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit bc91f53. Configure here.

@waleedlatif1
waleedlatif1 merged commit 936536e into staging Jul 22, 2026
20 checks passed
@waleedlatif1
waleedlatif1 deleted the nuqs-ee-settings-migration branch July 22, 2026 19:16
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