Preparing search index...

    Function useWarmSearchIndex

    • Warms a corpus-keyed search index during idle time after the corpus changes.

      On each new corpus reference, schedules build(corpus) via runWhenIdle. The build result is discarded — the point is the side effect of populating build's internal cache. A pending warm is cancelled when the corpus changes again or the consumer unmounts, so a fast sequence of mutations only ever warms the latest corpus.

      Type Parameters

      • T

        Corpus element type

      Parameters

      • build: (corpus: T[]) => void

        Corpus-keyed index builder (e.g. a makeItemIndexCache getter)

      • corpus: T[]

        Current corpus array; a new reference triggers a fresh warm

      Returns void