Skip to content

Release 1.0.2: fix search reset when paginating the catalog - #1

Merged
terencet-dev merged 1 commit into
mainfrom
fix/search-resets-on-pagination
Jul 1, 2026
Merged

Release 1.0.2: fix search reset when paginating the catalog#1
terencet-dev merged 1 commit into
mainfrom
fix/search-resets-on-pagination

Conversation

@terencet-dev

Copy link
Copy Markdown
Owner

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 on currentPage recomputed 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 single useMemo over a new pure selectRepositories() helper. All imperative setDisplayedRepos writes 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 clamping
  • app/registry/page.tsx — derive displayedRepos; delete the competing effects/writes; re-point feedback-loop deps to allRepositories
  • app/contexts/RepositoryContext.tsx — remove the now-dead filteredRepositories field
  • e2e/search-pagination.spec.ts (new) — regression test (search persists across pages)
  • Version bump to 1.0.2; CHANGELOG.md + issue-template updates

Scope / 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

  • Regression test RED without the fix (page 2 repo … should still match "azure"), GREEN with it; stable across repeated runs.
  • Query generality: 7 diverse queries (oss/v2/, windows, dotnet, uppercase AZURE, sql, oss/, kubernetes) all keep the filter across pagination.
  • Authenticated ACR: validated via a mocked-catalog test on a seeded type: 'authenticated' registry + confirmed auth-agnostic by code (real-ACR server round-trip not exercised — no live creds).
  • Regression sweep: clear-search, no-results empty state, deep-page clamp, forward/back pagination — all pass.
  • tsc clean, npm run build clean, broader e2e suite green.

Behavior changes (intentional, minor)

  • Empty registry → empty state (was: showed the full unfiltered list)
  • Single-registry view now sorts by name (consistency with combined view)
  • "All" search uses the same name+registry match on every path

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
artifactexplorer Ready Ready Preview, Comment Jul 1, 2026 5:20am
artifactexplorer-official Ready Ready Preview, Comment Jul 1, 2026 5:20am

Request Review

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant