The Trans Directory
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: parallelize search indexing

+13 -8
+13 -8
quartz/components/scripts/search.inline.ts
··· 464 464 searchBar?.addEventListener("input", onType) 465 465 window.addCleanup(() => searchBar?.removeEventListener("input", onType)) 466 466 467 - await fillDocument(data) 468 467 registerEscapeHandler(container, hideSearch) 468 + await fillDocument(data) 469 469 }) 470 470 471 471 /** ··· 475 475 */ 476 476 async function fillDocument(data: { [key: FullSlug]: ContentDetails }) { 477 477 let id = 0 478 + const promises: Array<Promise<unknown>> = [] 478 479 for (const [slug, fileData] of Object.entries<ContentDetails>(data)) { 479 - await index.addAsync(id++, { 480 - id, 481 - slug: slug as FullSlug, 482 - title: fileData.title, 483 - content: fileData.content, 484 - tags: fileData.tags, 485 - }) 480 + promises.push( 481 + index.addAsync(id++, { 482 + id, 483 + slug: slug as FullSlug, 484 + title: fileData.title, 485 + content: fileData.content, 486 + tags: fileData.tags, 487 + }), 488 + ) 486 489 } 490 + 491 + return await Promise.all(promises) 487 492 }