Skip to content

fix: create SCIM token dialog closing prematurely#906

Merged
rohan-chaturvedi merged 1 commit into
mainfrom
fix--scim-token-dialog
Jun 1, 2026
Merged

fix: create SCIM token dialog closing prematurely#906
rohan-chaturvedi merged 1 commit into
mainfrom
fix--scim-token-dialog

Conversation

@rohan-chaturvedi
Copy link
Copy Markdown
Member

@rohan-chaturvedi rohan-chaturvedi commented Jun 1, 2026

Summary

Fixes a bug where creating the first SCIM token caused the create-token dialog to close instantly, hiding the token before the user could copy it.

Root cause

SCIMPage rendered two separate CreateSCIMTokenDialog instances — one in the section header (shown when tokens exist), and a duplicate inside the EmptyState (shown only when tokens.length === 0). Creating the first token triggered a refetch that flipped the count from 0 → 1, unmounting the EmptyState branch and tearing down the open dialog along with its createdToken state. On the second attempt, the persistent header dialog was used, so the token displayed correctly.

Fix

  • Convert CreateSCIMTokenDialog to a forwardRef component exposing openModal/closeModal via useImperativeHandle, with no built-in trigger button.
  • Mount a single dialog instance at the page level, owned by createTokenDialogRef.
  • Render trigger buttons in both the header and the empty state; both call createTokenDialogRef.current?.openModal() on the same persistent dialog.

The dialog now survives the 0 → 1 token transition, so the newly created token stays visible and copyable.

Preview

Before

Screencast.From.2026-06-01.21-00-13.mp4

After

Screencast.From.2026-06-01.21-13-48.mp4

Review Focus

  • With zero SCIM tokens, click the empty-state "Create token" button → dialog opens.
  • Submit the form → token is created, dialog stays open and shows the token with a copy button.
  • Click "Done" → dialog closes, token appears in the credentials table.
  • With one or more tokens, click the header "Create token" button → dialog still works end-to-end.
  • Verify the empty-state button is hidden for users without SCIM:update permission.

Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
@rohan-chaturvedi rohan-chaturvedi added bug Something isn't working frontend Change in frontend code labels Jun 1, 2026
@rohan-chaturvedi rohan-chaturvedi merged commit 8b9347b into main Jun 1, 2026
15 checks passed
@rohan-chaturvedi rohan-chaturvedi deleted the fix--scim-token-dialog branch June 1, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend Change in frontend code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants