From 040666950d6327f9b62e0a95521111189aa788fc Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 12 Apr 2024 16:26:49 +0800 Subject: [PATCH] fix, Giscus --- components/Giscus.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/Giscus.js b/components/Giscus.js index a5bb2c50..ead62e35 100644 --- a/components/Giscus.js +++ b/components/Giscus.js @@ -16,12 +16,12 @@ const GiscusComponent = () => { const theme = isDarkMode ? 'dark' : 'light' useEffect(() => { loadExternalResource('/js/giscus.js', 'js').then(() => { - if (window.Giscus) { - window.Giscus.init('#giscus') + if (window?.Giscus?.init) { + window?.Giscus?.init('#giscus') } }) return () => { - window.Giscus.destroy() + window?.Giscus?.destroy() } }, [isDarkMode])