From f3d3e935ceabc4887ff9a9ec69b22bac9b29b930 Mon Sep 17 00:00:00 2001 From: emargareten <2771355@gmail.com> Date: Thu, 7 Mar 2024 12:20:09 +0200 Subject: [PATCH] Fix memory leak issue --- dist/inertia-modal.js | 3 ++- dist/inertia-modal.umd.js | 3 ++- js/useModal.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dist/inertia-modal.js b/dist/inertia-modal.js index e80a636..e34fe66 100644 --- a/dist/inertia-modal.js +++ b/dist/inertia-modal.js @@ -37,7 +37,8 @@ const plugin = { }, }; -const modal = computed(() => usePage()?.props?.modal); +const page = usePage(); +const modal = computed(() => page?.props?.modal); const props = computed(() => modal.value?.props); const key = computed(() => modal.value?.key); diff --git a/dist/inertia-modal.umd.js b/dist/inertia-modal.umd.js index 7d1129f..539e9d0 100644 --- a/dist/inertia-modal.umd.js +++ b/dist/inertia-modal.umd.js @@ -39,7 +39,8 @@ }, }; - const modal = vue.computed(() => vue3.usePage()?.props?.modal); + const page = vue3.usePage(); + const modal = vue.computed(() => page?.props?.modal); const props = vue.computed(() => modal.value?.props); const key = vue.computed(() => modal.value?.key); diff --git a/js/useModal.js b/js/useModal.js index f70c21a..0e7b2bf 100644 --- a/js/useModal.js +++ b/js/useModal.js @@ -2,7 +2,8 @@ import { router, usePage } from '@inertiajs/vue3' import { defineAsyncComponent, h, nextTick, watch, computed, ref, shallowRef } from 'vue' import resolver from './resolver' -const modal = computed(() => usePage()?.props?.modal); +const page = usePage() +const modal = computed(() => page?.props?.modal); const props = computed(() => modal.value?.props) const key = computed(() => modal.value?.key)