From 4e553521d24e85344d65ddad6debe90719b7f84e Mon Sep 17 00:00:00 2001 From: Corentin Forler <10946971+cogk@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:11:23 +0200 Subject: [PATCH] fix(pageMeta): Don't access `document` in top-level --- src/utils/pageMeta.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/pageMeta.js b/src/utils/pageMeta.js index ab4e072c..809efd57 100644 --- a/src/utils/pageMeta.js +++ b/src/utils/pageMeta.js @@ -1,9 +1,12 @@ import { watch } from 'vue' -let faviconRef = document.querySelector('link[rel="icon"]') -let defaultFavIcon = faviconRef?.href +let faviconRef = null +let defaultFavIcon = null export function usePageMeta(fn) { + faviconRef ??= document.querySelector('link[rel="icon"]') + defaultFavIcon ??= faviconRef?.href + watch( () => { try {