fix, Giscus

This commit is contained in:
tangly1024.com
2024-04-12 16:26:49 +08:00
parent cf68df2435
commit 040666950d

View File

@@ -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])