SurfSense/surfsense_web/app/(home)
yeranyang 4845b96209 perf(blog): derive search results with useMemo instead of useState+useEffect
Fixes #1246

Replace the useState/useEffect pattern that synced fuzzy search results
into local state on every search or searcher change with a single useMemo
that derives results directly during render.

Before:
  const [results, setResults] = useState(allBlogs);
  useEffect(() => {
    setResults(searcher.search(search));
  }, [search, searcher]);

After:
  const gridItems = useMemo(() => {
    const results = search.trim() ? searcher.search(search) : allBlogs;
    ...
  }, [search, searcher, allBlogs, featuredSlug]);

This removes an extra re-render per keystroke and eliminates the stale
intermediate state that occurred between the search input change and the
effect firing.
2026-04-29 12:34:12 +08:00
..
announcements feat(announcements): add SEO metadata via server layout.tsx 2026-04-24 15:58:20 -07:00
blog perf(blog): derive search results with useMemo instead of useState+useEffect 2026-04-29 12:34:12 +08:00
changelog feat: enhance SurfSense with new skills, blog section, and improve SEO metadata 2026-04-11 23:38:12 -07:00
contact feat: add processing mode support for document uploads and ETL pipeline, improded error handling ux 2026-04-14 21:26:00 -07:00
free feat: update SEO titles and descriptions for improved clarity and focus 2026-04-21 01:33:58 -07:00
login feat: add maxLength constraints to auth and settings form inputs 2026-04-16 22:33:01 +08:00
pricing cloud: added openrouter integration with global configs 2026-04-15 23:46:29 -07:00
privacy feat: enhance SurfSense with new skills, blog section, and improve SEO metadata 2026-04-11 23:38:12 -07:00
register feat: add maxLength constraints to auth and settings form inputs 2026-04-16 22:33:01 +08:00
terms feat: enhance SurfSense with new skills, blog section, and improve SEO metadata 2026-04-11 23:38:12 -07:00
layout.tsx feat: no login experience and prem tokens 2026-04-15 17:02:00 -07:00
page.tsx fix(a11y): remove nested <main> landmarks under (home) layout 2026-04-16 22:30:55 +08:00