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

Function listNotesStreamed

apps/desktop/src/preload/index.ts:100–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98}
99
100async function listNotesStreamed(): Promise<NoteMeta[]> {
101 const requestId = `${Date.now()}-${Math.random().toString(16).slice(2)}`
102 const notes: NoteMeta[] = []
103 let offset = 0
104
105 for (;;) {
106 const page = (await ipcRenderer.invoke(IPC.VAULT_LIST_NOTES_STREAM, {
107 requestId,
108 offset,
109 chunkSize: LIST_NOTES_STREAM_CHUNK_SIZE
110 })) as ListNotesPageResponse
111 if (Array.isArray(page.notes) && page.notes.length > 0) {
112 notes.push(...page.notes)
113 }
114 if (page.done) return notes
115 offset = page.nextOffset
116 await yieldRendererTask()
117 }
118}
119
120function stripQueryAndHash(value: string): string {
121 const hashIdx = value.indexOf('#')

Callers 1

index.tsFile · 0.85

Calls 1

yieldRendererTaskFunction · 0.85

Tested by

no test coverage detected