mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-03 21:02:40 +02:00
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. |
||
|---|---|---|
| .. | ||
| (home) | ||
| api | ||
| auth/callback | ||
| dashboard | ||
| db | ||
| desktop | ||
| docs | ||
| invite/[invite_code] | ||
| public/[token] | ||
| verify-token | ||
| apple-icon.png | ||
| error.tsx | ||
| favicon.ico | ||
| global-error.tsx | ||
| globals.css | ||
| icon.png | ||
| layout.config.tsx | ||
| layout.tsx | ||
| not-found.tsx | ||
| robots.ts | ||
| sitemap.ts | ||