diff --git a/pages/settings/profile/appearance.vue b/pages/settings/profile/appearance.vue index c8a4b2d7..340ab739 100644 --- a/pages/settings/profile/appearance.vue +++ b/pages/settings/profile/appearance.vue @@ -5,8 +5,6 @@ import { parse } from 'ultrahtml' definePageMeta({ middleware: 'auth', - // Keep alive the form page will reduce raw data timeliness and its status timeliness - keepalive: false, }) const { t } = useI18n() @@ -51,13 +49,8 @@ const { form, reset, submitter, dirtyFields, isError } = useForm({ }, }) -onMastoInit(async () => { - // Keep the information to be edited up to date - await pullMyAccountInfo() - reset() -}) - -const isCanSubmit = computed(() => !isError.value && !isEmptyObject(dirtyFields.value)) +const isDirty = $computed(() => !isEmptyObject(dirtyFields.value)) +const isCanSubmit = computed(() => !isError.value && isDirty) const { submit, submitting } = submitter(async ({ dirtyFields }) => { if (!isCanSubmit.value) @@ -76,6 +69,16 @@ const { submit, submitting } = submitter(async ({ dirtyFields }) => { setAccountInfo(account!.id, res.account) reset() }) + +const refreshInfo = async () => { + // Keep the information to be edited up to date + await pullMyAccountInfo() + if (!isDirty) + reset() +} + +onMastoInit(refreshInfo) +onReactivated(refreshInfo)