Fix type errors and prettier

This commit is contained in:
arg3t 2025-07-31 14:53:50 +02:00
parent 43cfbaae22
commit 689b54a945
7 changed files with 18 additions and 22 deletions

View File

@ -25,6 +25,7 @@ document.addEventListener("nav", (e: CustomEventMap["nav"]) => {
```
**When it fires:**
- On initial page load
- On client-side navigation (if SPA routing is enabled)
- Does NOT fire on content re-renders
@ -50,6 +51,7 @@ document.addEventListener("render", (e: CustomEventMap["render"]) => {
```
**When it fires:**
- On initial page load (with `document.body` as the container)
- When popover content is loaded
- When search results are displayed
@ -107,9 +109,11 @@ Always clean up event handlers to prevent memory leaks:
addRenderListener((container) => {
const buttons = container.querySelectorAll(".my-button")
const handleClick = (e) => { /* ... */ }
const handleClick = (e) => {
/* ... */
}
buttons.forEach(button => {
buttons.forEach((button) => {
button.addEventListener("click", handleClick)
// Clean up when navigating away
window.addCleanup(() => {

View File

@ -291,12 +291,6 @@ document.addEventListener("prenav", async () => {
document.addEventListener("nav", async (e: CustomEventMap["nav"]) => {
const currentSlug = e.detail.url
const rerender = e.detail.rerender
// If this is secondary nav call, do not populate explorer again
if (rerender) {
return
}
await setupExplorer(currentSlug)

View File

@ -577,9 +577,6 @@ function cleanupGlobalGraphs() {
document.addEventListener("nav", async (e: CustomEventMap["nav"]) => {
const slug = e.detail.url
// if we are rerendering, we can ignore this event
if (e.detail.rerender) return
addToVisited(simplifySlug(slug))
async function renderLocalGraph() {

View File

@ -1,5 +1,5 @@
import { computePosition, flip, inline, shift } from "@floating-ui/dom"
import { FullSlug, normalizeRelativeURLs } from "../../util/path"
import { normalizeRelativeURLs } from "../../util/path"
import { fetchCanonical, dispatchRenderEvent, addRenderListener } from "./util"
const p = new DOMParser()

View File

@ -137,7 +137,8 @@
}
// Hide the decrypt form when encrypted content appears in popover and search
.search-space, .popover {
.search-space,
.popover {
.encrypted-content .encryption-notice .decrypt-form {
display: none;
}