Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] v4 from jackyzha0:v4 #22

Merged
merged 5 commits into from
Nov 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: check if popover exists after fetching and before inserting
jackyzha0 committed Nov 12, 2023
commit d1551872ffeb08c34f59dc2042b43562c499b620
10 changes: 9 additions & 1 deletion quartz/components/scripts/popover.inline.ts
Original file line number Diff line number Diff line change
@@ -28,8 +28,11 @@ async function mouseEnterHandler(
})
}

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 @@ async function mouseEnterHandler(
console.error(err)
})

// bailout if another popover exists
if (hasAlreadyBeenFetched()) {
return
}

if (!contents) return
const html = p.parseFromString(contents, "text/html")
normalizeRelativeURLs(html, targetUrl)