Refactor Captcha Input Rendering in OpenForm Component

- Wrapped the CaptchaInput component in a ClientOnly block to ensure it only renders on the client side, preventing server-side rendering issues.
- Added a fallback template with a USkeleton component to provide a loading state while the CaptchaInput is being processed.

These changes aim to enhance the user experience by improving the rendering logic of the Captcha input, ensuring it behaves correctly in different environments.
This commit is contained in:
Julien Nahum 2025-04-11 16:04:55 +02:00
parent 8cb6e1238f
commit 20adfe076f
1 changed files with 15 additions and 10 deletions

View File

@ -57,16 +57,21 @@
</transition>
<!-- Captcha -->
<div class="mb-3 px-2 mt-4 mx-auto w-max">
<CaptchaInput
v-if="form.use_captcha && isLastPage && hasCaptchaProviders && isCaptchaProviderAvailable"
ref="captcha"
:provider="form.captcha_provider"
:form="dataForm"
:language="form.language"
:dark-mode="darkMode"
/>
</div>
<ClientOnly>
<div v-if="form.use_captcha && isLastPage && hasCaptchaProviders && isCaptchaProviderAvailable" class="mb-3 px-2 mt-4 mx-auto w-max">
<CaptchaInput
ref="captcha"
:provider="form.captcha_provider"
:form="dataForm"
:language="form.language"
:dark-mode="darkMode"
/>
</div>
<template #fallback>
<USkeleton class="h-[78px] w-[304px]" />
</template>
</ClientOnly>
<!-- Submit, Next and previous buttons -->
<div class="flex flex-wrap justify-center w-full">