Skip to content

Commit c42ce6c

Browse files
authored
chore(clerk-js): Clear API keys revoke confirmation field on modal close (#6604)
1 parent ce49740 commit c42ce6c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.changeset/cold-glasses-watch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/clerk-js": patch
3+
---
4+
5+
Clear API keys revoke confirmation field on modal close

packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ export const RevokeAPIKeyConfirmationModal = ({
4242

4343
const canSubmit = revokeField.value === t(localizationKeys('apiKeys.revokeConfirmation.confirmationText'));
4444

45+
const handleClose = () => {
46+
onClose();
47+
revokeField.setValue('');
48+
};
49+
4550
const handleSubmit = async (e: React.FormEvent) => {
4651
e.preventDefault();
4752
if (!apiKeyId || !canSubmit) return;
@@ -50,7 +55,7 @@ export const RevokeAPIKeyConfirmationModal = ({
5055
const cacheKey = { key: 'api-keys', subject };
5156

5257
void mutate(cacheKey);
53-
onClose();
58+
handleClose();
5459
};
5560

5661
if (!isOpen) {
@@ -60,7 +65,7 @@ export const RevokeAPIKeyConfirmationModal = ({
6065
return (
6166
<Modal
6267
handleOpen={onOpen}
63-
handleClose={onClose}
68+
handleClose={handleClose}
6469
canCloseModal={false}
6570
portalRoot={modalRoot}
6671
containerSx={[
@@ -107,7 +112,7 @@ export const RevokeAPIKeyConfirmationModal = ({
107112
submitLabel={localizationKeys('apiKeys.revokeConfirmation.formButtonPrimary__revoke')}
108113
colorScheme='danger'
109114
isDisabled={!canSubmit}
110-
onReset={onClose}
115+
onReset={handleClose}
111116
elementDescriptor={descriptors.apiKeysRevokeModalSubmitButton}
112117
/>
113118
</Form.Root>

0 commit comments

Comments
 (0)