MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / load

Function load

apps/web/src/export-window.tsx:119–145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

117 let cancelled = false
118
119 const load = async (): Promise<void> => {
120 try {
121 const [vault, notes, assetFiles, noteContent] = await Promise.all([
122 window.zen.getCurrentVault(),
123 window.zen.listNotes(),
124 window.zen.listAssets(),
125 window.zen.readNote(notePath)
126 ])
127 if (cancelled) return
128 if (!vault) {
129 throw new Error('No active vault was available for PDF export.')
130 }
131
132 useStore.setState({
133 vault: vault as VaultInfo,
134 notes: notes as NoteMeta[],
135 assetFiles: assetFiles as AssetMeta[],
136 selectedPath: noteContent.path,
137 activeNote: noteContent
138 })
139 document.title = `${noteContent.title}.pdf`
140 setNote(noteContent)
141 } catch (err) {
142 if (cancelled) return
143 setError(err instanceof Error ? err.message : String(err))
144 }
145 }
146
147 void load()
148

Callers 1

ExportNoteWindowFunction · 0.70

Calls 4

getCurrentVaultMethod · 0.65
listNotesMethod · 0.65
listAssetsMethod · 0.65
readNoteMethod · 0.65

Tested by

no test coverage detected