()
| 98 | } |
| 99 | |
| 100 | async 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 | |
| 120 | function stripQueryAndHash(value: string): string { |
| 121 | const hashIdx = value.indexOf('#') |
no test coverage detected