From db5e5b55eb879ec5b350d5d93f2051dc73506d44 Mon Sep 17 00:00:00 2001 From: Debora Crescenzo Date: Fri, 23 Jan 2026 13:57:39 +0000 Subject: [PATCH] MT#64292 Migrate App.Vue and vue-wait to Vue 3 Modernize vue-wait initialization and usage patterns to support Vue 3 Composition API while preserving Vue 2 Options API functionality. Changes: - Migrate App.vue to Vue 3 diff --git a/src/boot/vue-wait.js b/src/boot/vue-wait.js index 02717f3e..e969a7cf 100644 --- a/src/boot/vue-wait.js +++ b/src/boot/vue-wait.js @@ -1,12 +1,17 @@ import { createVueWait } from 'vue-wait-vue3' +export function initializeWait (app) { + const VueWait = createVueWait({ + useVuex: true, + vuexModuleName: 'wait', + registerDirective: true + }) + app.use(VueWait) + + return VueWait +} + export default ({ app }) => { - app.config.globalProperties.$initWait = () => { - const VueWait = createVueWait({ - useVuex: true, - vuexModuleName: 'wait', - registerDirective: true - }) - app.use(VueWait) - } + // Initialize wait immediately during boot + initializeWait(app) } diff --git a/src/composables/useWait.js b/src/composables/useWait.js new file mode 100644 index 00000000..128fee1e --- /dev/null +++ b/src/composables/useWait.js @@ -0,0 +1,15 @@ +import { getCurrentInstance } from 'vue' + +export function useWait () { + const instance = getCurrentInstance() + if (!instance) { + throw new Error('useWait must be called within a component setup function') + } + + const wait = instance.appContext.config.globalProperties.$wait + if (!wait) { + throw new Error('vue-wait is not initialized. Make sure vue-wait boot file runs before using useWait()') + } + + return wait +}