From 1c9fc740da36a5c755b8e07b17c1248aa0da10c1 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Thu, 30 May 2024 15:25:33 -0400 Subject: [PATCH] fix(elements): Ensure missing passwordSettings don't throw --- .changeset/strong-weeks-destroy.md | 5 +++++ packages/elements/src/react/hooks/use-password.hook.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/strong-weeks-destroy.md diff --git a/.changeset/strong-weeks-destroy.md b/.changeset/strong-weeks-destroy.md new file mode 100644 index 00000000000..b4fa9404455 --- /dev/null +++ b/.changeset/strong-weeks-destroy.md @@ -0,0 +1,5 @@ +--- +'@clerk/elements': patch +--- + +Ensure missing passwordSettings don't throw an error diff --git a/packages/elements/src/react/hooks/use-password.hook.ts b/packages/elements/src/react/hooks/use-password.hook.ts index 7368be21136..0ec7d44045d 100644 --- a/packages/elements/src/react/hooks/use-password.hook.ts +++ b/packages/elements/src/react/hooks/use-password.hook.ts @@ -20,7 +20,7 @@ type UsePasswordCallbacks = { export const usePassword = (callbacks?: UsePasswordCallbacks) => { const clerk = useClerk(); const passwordSettings = clerk.__unstable__environment?.userSettings.passwordSettings as PasswordSettingsData; - const { disable_hibp, min_zxcvbn_strength, show_zxcvbn, ...config } = passwordSettings; + const { disable_hibp, min_zxcvbn_strength, show_zxcvbn, ...config } = passwordSettings || {}; const { onValidationError = noop,