Enhance Form Manager with Reactive Mode Handling

- Introduced a reactive reference for the `mode` prop in `OpenCompleteForm.vue`, allowing for dynamic updates to the form mode.
- Updated the `useFormManager` function to accept a reactive `mode` reference, ensuring that the form management logic adapts to changes in the mode dynamically.
- Modified the strategy computation in `useFormManager` to utilize the reactive `mode`, improving the responsiveness of the form management system.

These changes aim to enhance the flexibility and adaptability of the form management system by allowing real-time updates to the form mode, thereby improving user interactions and overall experience.
This commit is contained in:
Julien Nahum
2025-05-27 20:51:53 +02:00
parent 72a87f1de8
commit 360b116062
2 changed files with 16 additions and 5 deletions

View File

@@ -246,6 +246,8 @@ const isAutoSubmit = ref(import.meta.client && window.location.href.includes('au
// Create a reactive reference directly from the prop
const darkModeRef = toRef(props, 'darkMode')
// Create a reactive reference for the mode prop
const modeRef = toRef(props, 'mode')
// Add back the local theme computation
const theme = computed(() => {
@@ -258,7 +260,8 @@ const theme = computed(() => {
let formManager = null
if (props.form) {
formManager = useFormManager(props.form, props.mode, {
darkMode: darkModeRef
darkMode: darkModeRef,
mode: modeRef
})
formManager.initialize({
submissionId: submissionId.value,