feat(github_search): add pagination, refresh, and race-safe concurrency - #4839
Open
GhagSagar23 wants to merge 1 commit into
Open
feat(github_search): add pagination, refresh, and race-safe concurrency#4839GhagSagar23 wants to merge 1 commit into
GhagSagar23 wants to merge 1 commit into
Conversation
…cy (felangel#2785) Extend the github_search example with infinite-scroll pagination and pull-to-refresh on top of the existing debounced search, using a single bloc with per-event transformers: debounce (search), droppable (next page), restartable (refresh). A monotonic generation stamp drops a stale next-page result that resolves after a refresh/new search, preventing the pagination corruption from the issue. Adds paged GithubClient/Repository, accumulating SearchStateSuccess, and Flutter + Angular UI wiring. Tests bring common_github_search to 100% line coverage (mocked repository/ client, no live network) and a dedicated CI job enforces min_coverage: 100. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
GhagSagar23
marked this pull request as ready for review
July 16, 2026 21:57
Author
|
Hello @felangel, this PR has been raised using AI. I am still testing the branch throughly. |
Author
|
Hey @felangel, this PR look good from my end. Can you please review this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status
IN DEVELOPMENT
Breaking Changes
NO
Description
Closes #2785.
Extends the
github_searchexample to demonstrate search + pagination +pull-to-refresh together with correct concurrency — the combination the
issue asks for. Per @felangel's guidance on the issue, this builds on
github_search(which already has debounced search) rather than modifying theflutter_infinite_listexample, which is intentionally kept minimal.Approach
A single
GithubSearchBlocwith one event type per concern, each using thebloc_concurrencytransformer that fits it:TextChangeddebounceNextPageRequesteddroppableRefreshedrestartableThe race the issue calls out
The reporter's core concern is a slow next-page request completing after
a refresh and corrupting pagination. Because per-handler transformers are
independent,
restartableonRefreshedcancels only its own future — not adroppablenext-page already awaiting. A monotonicgenerationstamp onSearchStateSuccessfixes this:_onNextPagecaptures the generation beforeits
awaitand drops the result if the generation moved while it was inflight (covers new-search and same-term-refresh). Proven deterministically
by a
Completer-driven test.Changes
common_github_search: pagedGithubClient/GithubRepository,accumulating
SearchStateSuccess(page/hasReachedMax/generation),new
NextPageRequested/Refreshedevents,bloc_concurrencydependency.flutter_github_search: infinite scroll +RefreshIndicator.angular_github_search: parity (Load More / Refresh) so it keeps building.common_github_searchat 100% line coverage (mockedrepository/client — no live network).
common_github_searchjob enforcingmin_coverage: 100.Type of Change