Jacky Zhao
2023-11-12 d1551872ffeb08c34f59dc2042b43562c499b620
fix: check if popover exists after fetching and before inserting
1 files modified
10 ■■■■■ changed files
quartz/components/scripts/popover.inline.ts 10 ●●●●● patch | view | raw | blame | history
quartz/components/scripts/popover.inline.ts
@@ -28,8 +28,11 @@
    })
  }
  const hasAlreadyBeenFetched = () =>
    [...link.children].some((child) => child.classList.contains("popover"))
  // dont refetch if there's already a popover
  if ([...link.children].some((child) => child.classList.contains("popover"))) {
  if (hasAlreadyBeenFetched()) {
    return setPosition(link.lastChild as HTMLElement)
  }
@@ -49,6 +52,11 @@
      console.error(err)
    })
  // bailout if another popover exists
  if (hasAlreadyBeenFetched()) {
    return
  }
  if (!contents) return
  const html = p.parseFromString(contents, "text/html")
  normalizeRelativeURLs(html, targetUrl)