mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-24 15:05:42 -05:00
FIX: Reload graph after a theme change - comment updated
This commit is contained in:
parent
bd67a5841b
commit
d76a323f34
@ -544,15 +544,15 @@ document.addEventListener("nav", async (e: CustomEventMap["nav"]) => {
|
|||||||
addToVisited(simplifySlug(slug))
|
addToVisited(simplifySlug(slug))
|
||||||
await renderGraph("graph-container", slug)
|
await renderGraph("graph-container", slug)
|
||||||
|
|
||||||
// Add this function to re-render the graph when the theme changes
|
// Function to re-render the graph when the theme changes
|
||||||
const handleThemeChange = () => {
|
const handleThemeChange = () => {
|
||||||
renderGraph("graph-container", slug)
|
renderGraph("graph-container", slug)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add event listener for theme change
|
// event listener for theme change
|
||||||
document.addEventListener("themechange", handleThemeChange)
|
document.addEventListener("themechange", handleThemeChange)
|
||||||
|
|
||||||
// Add cleanup for the event listener
|
// cleanup for the event listener
|
||||||
window.addCleanup(() => {
|
window.addCleanup(() => {
|
||||||
document.removeEventListener("themechange", handleThemeChange)
|
document.removeEventListener("themechange", handleThemeChange)
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user