Skip to content

H-3665: Paginate search bar#8902

Closed
alex-e-leon wants to merge 35 commits into
H-4819-entity-links-paginationfrom
H-3665-paginate-search-bar
Closed

H-3665: Paginate search bar#8902
alex-e-leon wants to merge 35 commits into
H-4819-entity-links-paginationfrom
H-3665-paginate-search-bar

Conversation

@alex-e-leon

Copy link
Copy Markdown
Contributor

🌟 What is the purpose of this PR?

Implements pagination on the search bar + refactors accumulate-pagination to be much simpler to use and reason about

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

@cursor

cursor Bot commented Jun 24, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
The pagination hook is shared by link tables and search; incorrect stale-completion or fold logic could duplicate or drop rows, though behavior is localized to frontend list UX.

Overview
Adds cursor-based infinite scroll to the header search bar and rewrites useAccumulatedCursorPagination so callers own merge logic via an appendPage(resetKey, fold) callback instead of seed / appendPage / finalize and a stored page list.

Search bar: Inline Apollo queries and result UI move to useSearchBarEntities and SearchResults. Entities load first (100 per page, uuid sort for stable cursors), then entity types under one loadMore / hasMore. Results render in a react-virtuoso list with endReached loading more.

Pagination hook: Drops generation-prefixed cursorKey and incremental page-array folding. Accumulation lives in hook state; each completion supplies a fold that returns the next getNextPage thunk or false. Stale completions are dropped via resetKey and comparing the in-flight request’s cursor.

Entity links: useEntityLinks is updated to the new hook API with the same dedupe/merge behavior folded in onCompleted. Loading flags use accumulated === undefined and page !== undefined instead of page count / cursor.

Reviewed by Cursor Bugbot for commit f7a101d. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment Jun 24, 2026 6:58pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Jun 24, 2026 6:58pm
petrinaut Skipped Skipped Jun 24, 2026 6:58pm

@github-actions github-actions Bot added area/apps > hash* Affects HASH (a `hash-*` app) type/eng > frontend Owned by the @frontend team area/apps labels Jun 24, 2026
No results found for&nbsp;<b>{submittedQuery}</b>.
</ResultItem>
</ResultListContainer>
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty search skips entity types

Medium Severity

When the first entity page returns no rows but more results remain, hasMore stays true while SearchResults treats an empty combined list as final and shows “No results found.” Entity-type fetching only starts after loadMore, which Virtuoso never mounts in that state, so matching entity types are never requested or shown.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9f27ed4. Configure here.

@alex-e-leon alex-e-leon force-pushed the H-3665-paginate-search-bar branch from 9f27ed4 to f7a101d Compare June 24, 2026 18:51
@vercel vercel Bot temporarily deployed to Preview – petrinaut June 24, 2026 18:52 Inactive

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f7a101d. Configure here.

cursorKeyOf(folded.getNextPage().cursor) ===
cursorKeyOf(requestRef.current?.cursor)
) {
return previous;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First page completion discarded

High Severity

When the first entity search page finishes and the next step is entity types, appendPage compares only cursor keys. Both the in-flight first request and { kind: "entityType", cursor: undefined } map to the same sentinel, so the fold is treated as a stale re-completion and discarded. Accumulation stays empty for most searches (single entity page).

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f7a101d. Configure here.

@alex-e-leon

Copy link
Copy Markdown
Contributor Author

Closing, as the search api is not able to be paginated. Instead we are applying a simple limit to the search query for now in #8886

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash* Affects HASH (a `hash-*` app) area/apps type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

1 participant