Skip to content

fix(catalog): align browsing client with backend entries API#74

Merged
pparage merged 1 commit into
devfrom
fix/issue-66-catalog-api-alignment
May 21, 2026
Merged

fix(catalog): align browsing client with backend entries API#74
pparage merged 1 commit into
devfrom
fix/issue-66-catalog-api-alignment

Conversation

@pparage
Copy link
Copy Markdown
Member

@pparage pparage commented May 21, 2026

Summary

The catalog grid was always empty: useCatalog.listEntries read data.entries, but GET /v1/catalog/entries returns a Page envelope ({ items, total, offset, limit }). The filter controls were also silently ignored — the client sent source/tags/os/difficulty/q, while the backend only honors source_id/kind/tag/offset/limit.

Changes

  • useCatalog reads data.items, sends only backend-honored params, and exposes a pure, unit-tested applyClientFilters() helper for presentation-side refinement (os/difficulty/free-text/multi-select).
  • CatalogList fetches the full entry set once and filters entirely client-side, so multi-select widening can never operate over a server-narrowed subset (avoids a transient/stale-cache empty-results bug). The previously dead os/difficulty/search controls now work.
  • CatalogTile renders container/ansible_role kind badges (the backend emits these; they previously fell through to a generic badge).
  • Fix the misleading catalog error-retry button (was labelled "Clear filters"; now common.retry, added to en/fr/jp).

Tests

  • Rewrote useCatalog tests to assert the real backend contract; added 7 applyClientFilters cases.
  • New CatalogList component test guarding the filter wiring — specifically the single→multi-select widening regression.
  • Full suite: 341 passing. ESLint clean. npm run build succeeds.

Closes #66

The catalog grid was always empty: the client read `data.entries` but the
backend returns a Page envelope (`{ items, total, offset, limit }`), and the
filter controls were silently ignored (client sent source/tags/os/difficulty/q;
the backend only honors source_id/kind/tag/offset/limit).

- useCatalog reads `data.items`; sends only backend-honored params; adds a pure,
  unit-tested `applyClientFilters` helper for presentation-side refinement.
- CatalogList fetches the full entry set once and filters entirely client-side,
  so multi-select widening can never operate over a server-narrowed subset.
- CatalogTile renders container/ansible_role kind badges.
- Fix the misleading catalog error-retry button label (common.retry).

Closes #66
@pparage pparage merged commit 5d2f3e0 into dev May 21, 2026
1 check failed
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