diff --git a/packages/client/src/composables/onContentUpdated.ts b/packages/client/src/composables/onContentUpdated.ts index 90cf68bce1..88903f7feb 100644 --- a/packages/client/src/composables/onContentUpdated.ts +++ b/packages/client/src/composables/onContentUpdated.ts @@ -8,6 +8,10 @@ import type { ContentUpdatedCallback } from '../types/index.js' * in the DOM. */ export const onContentUpdated = (fn: ContentUpdatedCallback): void => { + // callbacks are only invoked on client side, and components are never + // unmounted in ssr, so skip registering to avoid retaining them forever + if (__VUEPRESS_SSR__) return + contentUpdatedCallbacks.add(fn) onUnmounted(() => { contentUpdatedCallbacks.delete(fn)