Skip to content

Fix/rate limit per api - #1356

Open
Opulencechuks wants to merge 4 commits into
CalloraOrg:mainfrom
Opulencechuks:fix/rate-limit-per-api
Open

Opulencechuks wants to merge 4 commits into
CalloraOrg:mainfrom
Opulencechuks:fix/rate-limit-per-api

Conversation

@Opulencechuks

Copy link
Copy Markdown

Closes #1326

### Summary
Makes the Rate Limit page dynamic and per-API at `/marketplace/:apiId/rate-limits`, replacing the hardcoded fictional "GrantFox Wave Compute API" page at `/rate-limit`.

### Changes
- **Data Model**: Added optional `rateLimits` field to `APIItem` and populated mock data across sample APIs.
- **Route Predicate**: Added `isMarketplaceSubpage` in `src/routeMatchers.ts` to cleanly route subpages like `/sla` and `/rate-limits` to `App`, with unit tests in `src/routeMatchers.test.ts`.
- **Custom Router & Redirect**: Updated `src/renderRoute.tsx` to handle subpages properly, and updated `src/App.tsx` to route `/marketplace/:apiId/rate-limits` and redirect legacy `/rate-limit` requests to `/marketplace` with an explanatory toast.
- **Route Catalogue**: Removed `/rate-limit` from `src/config/routeCatalogue.ts` and `routePrefetchers` in `App.tsx` so 404 search does not recommend obsolete paths.
- **Component**: Refactored `RateLimitCard.tsx`:
  - Dynamically fetches the API entry from `fetchCatalog(signal)`.
  - Dynamically formats page title, document title, and breadcrumb path.
  - Dynamically hides empty columns (Burst limit, Concurrent connections).
  - Handles loading, empty ("This provider has not published rate limits"), not-found, and error states.
  - Added accessible table caption naming the API and locale-aware number formatting.
  - Removed all GrantFox literals.
- **Navigation**: Added a "View rate limits" link to the API Detail page sidebar.
- **Tests**: Replaced and extended `RateLimitCard.test.tsx` and created `routeMatchers.test.ts`.

### Test Output

✓ src/routeMatchers.test.ts (7 tests)
✓ src/pages/RateLimitCard.test.tsx (8 tests)
✓ RateLimitCard
✓ shows a loading state first
✓ renders three rows and a caption naming the API
✓ omits Burst and Concurrent columns when no tier has them
✓ shows the not-published state when the API has no rateLimits
✓ shows a not-found panel for an unknown id
✓ builds a breadcrumb from the API name whose hrefs all resolve to existing routes
✓ contains no GrantFox literals
✓ ROUTE_CATALOGUE
✓ has no dead /rate-limit entry

@drips-wave

drips-wave Bot commented Oct 20, 2026

Copy link
Copy Markdown

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

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.

Drive the Rate Limit page from the selected API instead of fixed example tiers

1 participant