Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions packages/core/src/vue/components/embed-pdf.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ provide<PDFContextState>(pdfKey, {
documentStates,
});

let unsubscribe: () => void | undefined;
onMounted(async () => {
// Merge deprecated logger prop into config (config.logger takes precedence)
const finalConfig: PluginRegistryConfig = {
Expand All @@ -83,7 +84,7 @@ onMounted(async () => {
const store = reg.getStore();
coreState.value = store.getState().core;

const unsubscribe = store.subscribe((action, newState, oldState) => {
unsubscribe = store.subscribe((action, newState, oldState) => {
// Only update if it's a core action and the core state changed
if (store.isCoreAction(action) && newState.core !== oldState.core) {
coreState.value = newState.core;
Expand All @@ -105,12 +106,13 @@ onMounted(async () => {
pluginsOk.value = true;
}
});
});

onBeforeUnmount(() => {
unsubscribe();
registry.value?.destroy();
});
onBeforeUnmount(() => {
unsubscribe?.();
registry.value?.destroy();
});

</script>

<template>
Expand Down