Skip to content

improvement(settings): one header action order across detail pages - #6206

Merged
waleedlatif1 merged 1 commit into
stagingfrom
settings-header-action-order
Aug 3, 2026
Merged

improvement(settings): one header action order across detail pages#6206
waleedlatif1 merged 1 commit into
stagingfrom
settings-header-action-order

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Every detail header now reads [secondary] → Delete → Discard → Save, matching the skills detail page.
  • Five pages rendered Discard → Save → Delete — a destructive chip to the right of the primary one — because they spread saveDiscardActions() first and appended Delete: sandboxes, custom tools, custom blocks, permission groups, data retention.
  • Fixed in the shell, not at nine callsites: orderHeaderActions() ranks actions (secondary → id:'discard'variant:'primary'), stable within each band. Writing the array the natural way now produces the right header, so a new detail page can't get it wrong.
  • Generalizes past Save — workflow MCP servers' Add workflows primary is now right-most with Delete before it.
  • Delete is a plain chip on the nine resource-detail headers, matching skills, each with a stable id:'delete' (three lacked one, so the chip remounted when its label flipped to Deleting...).
  • variant:'destructive' kept for actions destructive at scaleDelete all passwords, Clear all browsing data, Sign out all members. Removing the single resource you're viewing is already confirm-gated.
  • action.id added to the header re-render signature, since the sort key now reads it.

Note on the risky part

The shell routes onSelect through configRef.current.actions[index] to avoid stale closures. Reordering the render without preserving the source index would bind every chip to the wrong handler — clicking Delete would Save. orderHeaderActions carries {action, index} pairs, and settings-header-shell.test.tsx pins that at the render level including the conditional-Discard case where a missing action shifts every index. I verified the tests go red when the indices are renumbered.

Type of Change

  • Improvement

Testing

tsc and biome clean; 668 tests pass across settings/skills/integrations/ee. Two new test files (14 cases) cover the ranking and the render-level handler routing; both verified to fail when the mechanism is removed. Not exercised in a browser.

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)

Detail headers disagreed on where Delete sits. The skills page reads
`Share → Delete → Discard → Save`, but every SettingsPanel page spread
saveDiscardActions() first and appended Delete, rendering it to the RIGHT of
the primary chip: sandboxes, custom tools, custom blocks, permission groups and
data retention all did this.

Fixed in the shell rather than at nine callsites. orderHeaderActions() ranks
actions — secondary, then `id:'discard'`, then `variant:'primary'` — stably
within each band, so writing the array the natural way now produces the right
header and a new detail page cannot get it wrong. This generalizes past Save:
workflow MCP servers' `Add workflows` primary is now right-most with Delete
before it, instead of the reverse.

The ranking has to survive one trap. The shell routes onSelect through
configRef.current.actions[index] to avoid stale closures, so reordering the
render without preserving the source index would bind every chip to the wrong
handler — clicking Delete would Save. orderHeaderActions carries {action,index}
pairs; settings-header-shell.test.tsx pins that at the render level, including
the conditional-Discard case where a missing action shifts every index.

Delete is also now a plain chip on the nine resource-detail headers, matching
skills, each with a stable `id:'delete'` (three lacked one, so the chip
remounted when its label flipped to Deleting...). `variant:'destructive'` is
kept for actions destructive at scale — Delete all passwords, Clear all
browsing data, Sign out all members — which the confirm modal does not cover
the way it covers removing the single resource you are looking at.
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Building Building Preview Aug 3, 2026 5:12pm

Request Review

@cursor

cursor Bot commented Aug 3, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
UI-only header ordering and chip styling with ref-index routing covered by new tests; no auth, data, or API behavior changes.

Overview
Settings detail headers now enforce a consistent chip order: secondary actions → Delete → Discard → Save, with the primary action always right-most (Save, Add workflows, Import, etc.).

orderHeaderActions() in settings-header.tsx ranks actions in the shell and SettingsActionChips, so callers can spread saveDiscardActions() first and still get the correct layout. Reordering preserves original array indices so SettingsHeaderShell ref-based onSelect routing stays correct when chips are visually reordered.

Delete on resource detail pages is now a plain chip with stable id: 'delete' (no variant: 'destructive'); destructive is reserved for bulk actions like Delete all or Sign out all members. Several detail pages (sandboxes, custom tools, MCP, workflow MCP servers, passwords, permission groups, custom blocks, data drains, data retention) were updated accordingly.

Docs in sim-settings-pages.md describe header order and delete styling. New tests cover ranking and render-level handler binding.

Reviewed by Cursor Bugbot for commit 2cdda6c. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR centralizes settings-header action ordering and standardizes single-resource delete actions.

  • Adds stable ordering for secondary, Delete, Discard, and primary actions while preserving original handler indices.
  • Assigns stable delete action identities and replaces destructive styling on confirmation-gated single-resource deletes.
  • Adds unit and render-level coverage for ordering, stable sorting, conditional actions, and handler routing.

Confidence Score: 5/5

The PR appears safe to merge with no actionable regressions identified.

The centralized sort preserves stable within-band order and original action indices, while changed delete actions retain their existing authorization and confirmation paths.

Important Files Changed

Filename Overview
apps/sim/components/settings/settings-header.tsx Introduces stable action ranking while retaining source indices for current-ref handler dispatch.
apps/sim/components/settings/settings-header-order.test.ts Covers action bands, stable within-band order, original indices, empty inputs, and input immutability.
apps/sim/components/settings/settings-header-shell.test.tsx Verifies rendered ordering and correct handler routing when sorting or conditional actions shift positions.
apps/sim/app/workspace/[workspaceId]/settings/components/workflow-mcp-servers/workflow-mcp-servers.tsx Standardizes the detail delete action and allows the primary Add workflows action to render right-most.
apps/sim/app/workspace/[workspaceId]/settings/components/custom-tools/components/custom-tool-detail/custom-tool-detail.tsx Gives the delete action stable identity and plain styling while retaining its confirmation flow.
apps/sim/app/workspace/[workspaceId]/settings/components/sandboxes/sandboxes.tsx Standardizes the confirmation-gated sandbox delete action for centralized header ordering.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Caller action array] --> B[Pair action with original index]
  B --> C[Stable rank ordering]
  C --> D[Secondary actions]
  C --> E[Delete]
  C --> F[Discard]
  C --> G[Primary action]
  D --> H[Rendered header]
  E --> H
  F --> H
  G --> H
  H --> I[Invoke handler through original source index]
Loading

Reviews (1): Last reviewed commit: "improvement(settings): one header action..." | Re-trigger Greptile

@waleedlatif1
waleedlatif1 merged commit b741176 into staging Aug 3, 2026
26 of 27 checks passed
@waleedlatif1
waleedlatif1 deleted the settings-header-action-order branch August 3, 2026 17:18
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