Repository navigation
feat(prompts): paginate High frequency table 10/page with numbered controls (#349) - #355
Conversation
…ols, reset on brand change + track) Closes #349 - Rename CardTitle from 'Query fan-out' to 'High frequency' - Add PAGE_SIZE=10 constant and page state (useState(1)) - Slice subQueries into pageRows for current page (client-side, no server changes) - Render numbered page buttons below table using shadcn Button component - Active page uses variant=default, others variant=ghost - Reset page to 1 on brandId change via useEffect - Reset page to 1 after successful track inside handleTrack - Zero new TypeScript errors introduced (verified via tsc --noEmit diff) Signed-off-by: Maqbool Ahmed <[email protected]>
There was a problem hiding this comment.
Welcome to Ansvisor, and thank you for your first PR! A maintainer will be by soon to review.
In the meantime, two things that make review faster:
- A short description of why the change matters, not just what it does — most of our PRs link a
Fixes #...to the issue that explains the why. - A quick local test note if there's anything worth eyeballing in the browser.
If you'd like to keep an eye on where Ansvisor goes next, a ⭐ on the repo helps others discover it (and Watch sends you a ping when related issues land). Either way — looking forward to your next one.
gkhngyk
left a comment
There was a problem hiding this comment.
Nice work — the logic is spot on: pagination (10/page), the numbered controls, the brand-change + post-track resets, the "High frequency" heading, and the intent column all stay intact. 🙌
One thing before merge: the file isn't Prettier-formatted — the wrapped table block needs re-indenting, so CI's format:check will fail. Please run yarn format from web/ and commit the result.
Optional / non-blocking: computing totalPages and pageRows as consts just above the return ( would read a bit cleaner than the inline IIFE — totally your call.
Thanks for the contribution!
Signed-off-by: Maqbool Ahmed <[email protected]>
gkhngyk
left a comment
There was a problem hiding this comment.
Thanks for the quick fix — Prettier's happy now (format diff is clean) and the pagination logic is unchanged: 10/page, numbered controls, brand-change + post-track resets, the "High frequency" heading, and the intent column all intact. LGTM! 🎉
Closes #349
What changed
All changes are contained in a single file:
_fanout-tab.tsx.1. Renamed heading
CardTitletext changed from"Query fan-out"→"High frequency"as specified in the issue.2. Client-side pagination (10/page)
pagestate (useState(1)) and aPAGE_SIZE = 10constant.data.subQueriesis sliced intopageRowsusing(page - 1) * PAGE_SIZEoffset before being passed to the table — no server changes needed.3. Numbered page controls
totalPages > 1.Buttonfrom the existing shadcn/ui component.variant="default", others usevariant="ghost"for clear visual distinction.4. Page reset on brand change
useEffectwatchingbrandIdthat callssetPage(1)— ensures switching brands always starts at page 1.5. Page reset after successful track
setPage(1)called insidehandleTrackimmediately aftertoast.success— ensures the user lands back on page 1 after tracking a query.What was NOT changed
fanout.tsunchanged).tsc --noEmitdiff before/after).Testing