Related Area
Frontend
Is there an existing issue for this?
Describe the bug
In HomeScreen.tsx, the app uses a paginated article loader that accumulates all fetched articles into allArticlesRef.current across multiple pages. However, the handleSearch function searches only articleData?.articles β which is the React Query result containing only the most recently fetched page β instead of allArticlesRef.current which holds all accumulated articles.
Every other consumer in the component uses allArticlesRef.current correctly:
updateArticles(allArticlesRef.current) β category filter
handleFilterReset β dispatch uses allArticlesRef.current
- Auto-pagination guard β filters from
allArticlesRef.current
Only handleSearch was left pointing at the stale per-page snapshot.
Affected file: frontend/src/screens/HomeScreen.tsx
Buggy code (line ~479):
const matchesSearch = articleData?.articles.filter(article => { ... });
Expected behavior
Searching should match against all articles loaded so far across all pages (allArticlesRef.current), not just the articles returned by the most recent page fetch. If a user has scrolled through 3 pages and searches for an article from page 1, it should appear in results.
Add ScreenShots
What browsers are you seeing the problem on?
No response
Record
Related Area
Frontend
Is there an existing issue for this?
Describe the bug
In HomeScreen.tsx, the app uses a paginated article loader that accumulates all fetched articles into
allArticlesRef.currentacross multiple pages. However, thehandleSearchfunction searches onlyarticleData?.articlesβ which is the React Query result containing only the most recently fetched page β instead ofallArticlesRef.currentwhich holds all accumulated articles.Every other consumer in the component uses
allArticlesRef.currentcorrectly:updateArticles(allArticlesRef.current)β category filterhandleFilterResetβ dispatch usesallArticlesRef.currentallArticlesRef.currentOnly
handleSearchwas left pointing at the stale per-page snapshot.Affected file:
frontend/src/screens/HomeScreen.tsxBuggy code (line ~479):
const matchesSearch = articleData?.articles.filter(article => { ... });
Expected behavior
Searching should match against all articles loaded so far across all pages (allArticlesRef.current), not just the articles returned by the most recent page fetch. If a user has scrolled through 3 pages and searches for an article from page 1, it should appear in results.
Add ScreenShots
What browsers are you seeing the problem on?
No response
Record