Skip to content

Commit

Permalink
Vue3: call onBeforeUmount once (#9080)
Browse files Browse the repository at this point in the history
  • Loading branch information
dk981234 authored Nov 20, 2024
1 parent 9c93773 commit fae77a6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/survey-vue3-ui/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,18 @@ export function useBase<T extends Base>(
immediate: true,
}
);
let isOnBeforeUnmountCalled = false;
onBeforeUnmount(() => {
const model = getModel();
if (model) {
unMakeReactive(model);
stopWatch();
if (!isOnBeforeUnmountCalled) {
const model = getModel();
if (model) {
unMakeReactive(model);
stopWatch();
if (clean) clean(model);
}
isOnBeforeUnmountCalled = true;
}
});
onUnmounted(() => {
const model = getModel();
if (model && clean) clean(model);
});
}

export function useQuestion<T extends Question>(
Expand Down

0 comments on commit fae77a6

Please sign in to comment.