perf(offline): parallelise note caching with batched writes

Fetch blobs with a concurrency of 8 instead of one at a time, batch
PouchDB writes via bulkUpdate, filter already-cached files up front,
and run the README fetch in parallel with the worker loop.
This commit is contained in:
Julien Calixte
2026-05-16 23:48:06 +02:00
parent 2002ac670a
commit f3ed5e063f
2 changed files with 78 additions and 30 deletions

View File

@@ -11,6 +11,23 @@ type NoteCacheResult =
| { note: Note; from: "path" }
| { note: null; from: null }
export const buildNoteDocs = (
sha: string,
path: string | undefined,
content: string,
editedSha?: string
): Note[] => {
const base: Note = {
_id: generateId(DataType.Note, sha),
$type: DataType.Note,
content,
editedSha
}
return path
? [base, { ...base, _id: generateId(DataType.Note, path) }]
: [base]
}
export const prepareNoteCache = (sha: string, path?: string) => {
const store = useUserRepoStore()