Release 1.0.2: fix search reset when paginating the catalog - #1
Merged
Conversation
The registry catalog's displayed repository list was stored as state and kept in sync by competing effects; one recomputed it on every page change filtered only by registry (ignoring the active search query) and, by effect ordering, overwrote the search-filtered page — so paging to the next page reset the search on large registries like mcr.microsoft.com. The displayed list is now derived purely from the loaded catalog, the active filters, and the current page via a single useMemo over a new pure selectRepositories() helper. The ~30 imperative setDisplayedRepos writes and the 3 competing effects are removed. The change is auth/vendor-agnostic — it touches only the display layer, not the fetch/credential path. - app/utils/repositorySelect.ts: pure filter -> sort -> paginate selector - app/registry/page.tsx: derive displayedRepos; delete competing effects/writes - app/contexts/RepositoryContext.tsx: drop the dead filteredRepositories field - e2e/search-pagination.spec.ts: regression test (search persists across pages) - Bump version to 1.0.2; update CHANGELOG and issue template Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
On registries large enough to span multiple pages (e.g.
mcr.microsoft.com), searching the repository catalog and then clicking next page reverted the results to the full, unfiltered catalog — the search "reset" on pagination.Root cause: the displayed repository list was stored as React state and kept in sync by ~30 imperative writes plus competing
useEffects. Two effects keyed oncurrentPagerecomputed the list filtered only by registry — ignoring the active search query — and, by effect declaration order, ran last and overwrote the search-filtered page.Fix: the displayed list is now a pure derivation of
(catalog, searchQuery, searchType, viewMode, currentRegistryId, currentPage, pageSize)via a singleuseMemoover a new pureselectRepositories()helper. All imperativesetDisplayedReposwrites and the 3 competing effects are removed, so the "one effect clobbers another" race is structurally impossible.Pre-existing since the first public release; not introduced by 1.0.1.
Changes
app/utils/repositorySelect.ts(new) — pure filter → sort → paginate selector with page clampingapp/registry/page.tsx— derivedisplayedRepos; delete the competing effects/writes; re-point feedback-loop deps toallRepositoriesapp/contexts/RepositoryContext.tsx— remove the now-deadfilteredRepositoriesfielde2e/search-pagination.spec.ts(new) — regression test (search persists across pages)CHANGELOG.md+ issue-template updatesScope / safety
Touches only the display layer — no changes to the fetch/credential/auth path (
registryService,api/registry). The fix is therefore auth- and vendor-agnostic: it works identically for anonymous MCR and authenticated ACRs.Validation
page 2 repo … should still match "azure"), GREEN with it; stable across repeated runs.oss/v2/,windows,dotnet, uppercaseAZURE,sql,oss/,kubernetes) all keep the filter across pagination.type: 'authenticated'registry + confirmed auth-agnostic by code (real-ACR server round-trip not exercised — no live creds).tscclean,npm run buildclean, broader e2e suite green.Behavior changes (intentional, minor)
🤖 Generated with Claude Code