Skip to content

Commit 3a00a3f

Browse files
committed
fix(settings): Save a data retention policy or source secrets once edited, not never
SaveActions disables Save whenever blockedReason is set, and both pages passed a fixed reason, so their Save stayed disabled through every edit.
1 parent 4c9264f commit 3a00a3f

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎apps/sim/app/(product)/_components/settings-parts/save-bar.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface SettingsSaveBarProps {
88
saving: boolean
99
/** Save cannot run for a reason the page already shows, such as a field's error. */
1010
blocked?: boolean
11-
/** Why Save is blocked, for a reason the page does not already show. */
11+
/** Why Save is blocked, for a reason the page does not already show. Set only while blocked: Save is disabled whenever it is set. */
1212
blockedReason?: string
1313
/** Omitted inside a `<form>` that owns validation: Save then submits it. */
1414
onSave?: () => void

‎apps/sim/app/(product)/o/[organizationId]/settings/_components/sections/data-retention/policy-detail.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,9 @@ export function PolicyDetail({
375375
<SettingsSaveBar
376376
dirty={dirty}
377377
saving={isSaving}
378-
blocked={!isOrg && draft.workspaceIds.length === 0}
379-
blockedReason='Select at least one workspace'
378+
blockedReason={
379+
!isOrg && draft.workspaceIds.length === 0 ? 'Select at least one workspace' : undefined
380+
}
380381
onSave={onSave}
381382
onDiscard={onDiscard}
382383
/>

‎apps/sim/app/(product)/o/[organizationId]/settings/_components/sections/integrations/source-secrets.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,11 @@ export function SecretSettings({ data, href, update }: SecretSettingsProps) {
105105
<SettingsSaveBar
106106
dirty={dirty}
107107
saving={false}
108-
blocked={!valid}
109-
blockedReason='Name each secret with letters, digits and underscores, give a new one a value, and keep names unique'
108+
blockedReason={
109+
valid
110+
? undefined
111+
: 'Name each secret with letters, digits and underscores, give a new one a value, and keep names unique'
112+
}
110113
onSave={() => {
111114
update((current) => ({ ...current, secrets: names }))
112115
setRows(rows.map((row) => ({ ...row, name: row.name.trim(), value: '', saved: true })))

0 commit comments

Comments
 (0)