Skip to content

Commit 3858fcd

Browse files
committed
fix(sso): keep an exit affordance in edit mode when clean
After clicking Edit on an existing SSO provider, the only header action was SaveDiscardActions, which renders nothing when the form is clean — so there was no way to leave edit mode back to the read-only summary without first changing a field or navigating away. Render a Cancel chip when isEditing && !hasChanges (the dirty-gated Discard already exits when there are changes).
1 parent d493263 commit 3858fcd

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

apps/sim/ee/sso/components/sso-settings.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { getErrorMessage } from '@sim/utils/errors'
66
import { Check, ChevronDown, Clipboard, Eye, EyeOff } from 'lucide-react'
77
import {
88
Button,
9+
Chip,
910
ChipCombobox,
1011
ChipInput,
1112
ChipSelect,
@@ -535,15 +536,22 @@ export function SSO() {
535536

536537
<SettingsPanel
537538
actions={
538-
<SaveDiscardActions
539-
dirty={hasChanges}
540-
saving={configureSSOMutation.isPending}
541-
saveDisabled={hasAnyErrors(errors) || !isFormValid()}
542-
saveLabel={isEditing ? 'Update' : 'Save'}
543-
savingLabel={isEditing ? 'Updating...' : 'Saving...'}
544-
onSave={() => void handleSubmit()}
545-
onDiscard={handleDiscard}
546-
/>
539+
<>
540+
{isEditing && !hasChanges && (
541+
<Chip onClick={handleDiscard} disabled={configureSSOMutation.isPending}>
542+
Cancel
543+
</Chip>
544+
)}
545+
<SaveDiscardActions
546+
dirty={hasChanges}
547+
saving={configureSSOMutation.isPending}
548+
saveDisabled={hasAnyErrors(errors) || !isFormValid()}
549+
saveLabel={isEditing ? 'Update' : 'Save'}
550+
savingLabel={isEditing ? 'Updating...' : 'Saving...'}
551+
onSave={() => void handleSubmit()}
552+
onDiscard={handleDiscard}
553+
/>
554+
</>
547555
}
548556
>
549557
<div className='flex flex-col gap-4.5'>

0 commit comments

Comments
 (0)