Skip to content

feat(marketplace): send search and category to /api/apis - #1353

Merged
greatest0fallt1me merged 3 commits into
CalloraOrg:mainfrom
Johnsource-hub:feat/marketplace-server-filters
Oct 24, 2026
Merged

greatest0fallt1me merged 3 commits into
CalloraOrg:mainfrom
Johnsource-hub:feat/marketplace-server-filters

Conversation

@Johnsource-hub

Copy link
Copy Markdown
Contributor

closes #1328

Changes Made

  1. New API Module (src/api/catalogApi.ts)
  • fetchCatalog(signal, params?) - Fetches from /api/apis with search and category query params
  • buildCacheKey(params) - Creates cache keys including server params (exported for testing)
  • Per-query caching with ETags via sessionStorage
  • Proper URLSearchParams serialization (trims, omits empty values)
  • Uses import.meta.env.VITE_API_BASE_URL with fallback
  1. Config Module (src/config/api.ts)
  • getApiBaseUrl() - Reads from VITE_API_BASE_URL
  • isBackendMode() - Boolean check for backend mode
  1. MarketplacePage.tsx Updates
  • Detects backend mode via isBackendMode
  • In backend mode: fetches from server with debounced search (300ms) and single category
  • Multiple categories: fetches without category, filters client-side
  • Client-side filters preserved: tags, price, status, favorites, popularity, sort
  • Race condition handling with requestSeqRef + abortRef pattern
  • Demo mode unchanged: uses MOCK_APIS with client-side filtering only
  1. Tests
  • catalogApi.test.ts: 15 tests passing (cache keys, fetch params, caching, abort, errors)
  • MarketplacePage.test.tsx: 8 demo mode tests passing; backend mode "fetches on mount" passes in isolation
    Test Results
    catalogApi.test.ts: 15 passed
    MarketplacePage.test.tsx (demo mode): 8 passed
    Known Issue
    Backend mode tests have isolation issues when run together (env stubbing + module reset timing). The functionality works correctly when tested individually.
    Acceptance Criteria Met
  • ✅ Network tab shows GET /api/apis?search=... per settled query
  • ✅ TypeScript compiles (pre-existing errors in unrelated files only)
  • ✅ Debounce + abort + race guarantees implemented
  • ✅ Cache keys include server params
  • ✅ Multi-category trade-off documented (fetch without category, filter client-side)
  • ✅ Client-side filters preserved for unsupported filters
  • ✅ Live region announcements via existing empty state

@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@Johnsource-hub Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Johnsource-hub
Johnsource-hub marked this pull request as draft October 23, 2026 07:14
@Johnsource-hub
Johnsource-hub marked this pull request as ready for review October 23, 2026 07:14
@greatest0fallt1me
greatest0fallt1me merged commit f1949fd into CalloraOrg:main Oct 24, 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.

Push marketplace search and single-category filters to /api/apis when a backend is configured

2 participants