fix: resolve TDZ error on password update settings page

Move the watchEffect call after the validate function declaration
to fix "Cannot access 'c' before initialization" error that occurred
when visiting the password update page with validateInitially=true.

Fixes #2463
This commit is contained in:
kolaente 2026-03-24 16:09:45 +01:00 committed by kolaente
parent 4b16d72e28
commit 6d2bf1f084
1 changed files with 2 additions and 2 deletions

View File

@ -60,13 +60,13 @@ const password = ref('')
const isValid = ref<true | string>(props.validateInitially === true ? true : '') const isValid = ref<true | string>(props.validateInitially === true ? true : '')
const validateAfterFirst = ref(false) const validateAfterFirst = ref(false)
watchEffect(() => props.validateInitially && validate())
const validate = useDebounceFn(() => { const validate = useDebounceFn(() => {
const valid = validatePassword(password.value, props.validateMinLength) const valid = validatePassword(password.value, props.validateMinLength)
isValid.value = valid === true ? true : t(valid) isValid.value = valid === true ? true : t(valid)
}, 100) }, 100)
watchEffect(() => props.validateInitially && validate())
function togglePasswordFieldType() { function togglePasswordFieldType() {
passwordFieldType.value = passwordFieldType.value === 'password' passwordFieldType.value = passwordFieldType.value === 'password'
? 'text' ? 'text'