ATQQ / sugar-blog

✍️📚我写博客的地方🤪🤪🤪记录随笔与学习笔记,仓库包含:博客内容,博客主题、博客模板、vitepress离线全文搜索插件、VitePress RSS 支持插件;a blog theme use vitepress
https://sugarat.top
MIT License
361 stars 65 forks source link

Use pagefind.debouncedSearch() #260

Closed slusarz closed 3 months ago

slusarz commented 3 months ago

This provides a much smoother search UX, as it minimizes the search queries executed in addition to leveraging preloading.

See https://pagefind.app/docs/api/#debounced-search and https://pagefind.app/docs/api/#preloading-search-terms

ATQQ commented 3 months ago

Looks great, thanks for your contribution.

I'll come down and test it, and will release it in the next version as soon as possible. @ You

ATQQ commented 3 months ago

I merge it first, and then I will add a option to the debounce time to make it controllable.

ATQQ commented 3 months ago

you can try vitepress-plugin-pagefind@0.4.5

and I add option delay, default value 300(same as in the official documents)

export interface SearchConfig {
  // ...other
  /**
   * debouncedSearch delay
   * @default 300
   */
  delay?: number
}