Skip to content

Commit

Permalink
Use defer than async for giscus script
Browse files Browse the repository at this point in the history
  • Loading branch information
winterjung committed Nov 4, 2024
1 parent 642bcb3 commit a831c36
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/giscus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ export default function Giscus() {
"data-lang": "ko",
"data-loading": "lazy",
crossorigin: "anonymous",
async: true,
defer: true,
}

Object.entries(giscusAttributes).forEach(([key, value]) => {
script.setAttribute(key, value)
})

containerRef.current.appendChild(script)
const container = containerRef.current
container.appendChild(script)
return () => {
containerRef.current?.removeChild(script)
container?.removeChild(script)
}
}, [])

Expand Down

0 comments on commit a831c36

Please sign in to comment.