Skip to content

Commit

Permalink
Vue3: Clean model only after unmount (#9058)
Browse files Browse the repository at this point in the history
  • Loading branch information
dk981234 authored Nov 15, 2024
1 parent b875ff9 commit 225258f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/survey-vue3-ui/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
onBeforeUnmount,
watchEffect,
nextTick,
onUnmounted,
} from "vue";
Base.createPropertiesHash = () => {
const res = shallowReactive({});
Expand Down Expand Up @@ -121,10 +122,13 @@ export function useBase<T extends Base>(
const model = getModel();
if (model) {
unMakeReactive(model);
if (clean) clean(model);
stopWatch();
}
});
onUnmounted(() => {
const model = getModel();
if (model && clean) clean(model);
});
}

export function useQuestion<T extends Question>(
Expand Down Expand Up @@ -163,6 +167,10 @@ export function useLocString(
{ immediate: true }
);
onBeforeUnmount(() => {
const locString = getLocString();
if (locString) {
locString.onChanged = () => {};
}
stopWatch();
});
return renderedHtml;
Expand Down

0 comments on commit 225258f

Please sign in to comment.