diff --git a/.changeset/cold-glasses-watch.md b/.changeset/cold-glasses-watch.md new file mode 100644 index 00000000000..9def8809de7 --- /dev/null +++ b/.changeset/cold-glasses-watch.md @@ -0,0 +1,5 @@ +--- +"@clerk/clerk-js": patch +--- + +Clear API keys revoke confirmation field on modal close diff --git a/packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx b/packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx index c77e8fc37f3..2b51bd874f8 100644 --- a/packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx +++ b/packages/clerk-js/src/ui/components/ApiKeys/RevokeAPIKeyConfirmationModal.tsx @@ -42,6 +42,11 @@ export const RevokeAPIKeyConfirmationModal = ({ const canSubmit = revokeField.value === t(localizationKeys('apiKeys.revokeConfirmation.confirmationText')); + const handleClose = () => { + onClose(); + revokeField.setValue(''); + }; + const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (!apiKeyId || !canSubmit) return; @@ -50,7 +55,7 @@ export const RevokeAPIKeyConfirmationModal = ({ const cacheKey = { key: 'api-keys', subject }; void mutate(cacheKey); - onClose(); + handleClose(); }; if (!isOpen) { @@ -60,7 +65,7 @@ export const RevokeAPIKeyConfirmationModal = ({ return (