improve page navigation by slimming code#80
Merged
Conversation
The provider catalog list embedded every endpoint's full JSON Schema (inputSchema) and lastUpdated into the resources aggregate. The frontend never reads either field, and inputSchema alone accounted for ~52% of the /providers payload. Remove both from the resources LATERAL aggregation in both UNION branches.
The geo-spec page awaited params, TopBar context, and the provider catalog serially; the catalog fetch dominates latency and needlessly blocked the others. Run the three concurrently via Promise.all. Also cap snapshot-backed BFF requests with an 8s AbortSignal timeout so a slow or cold BFF can no longer hang a server render (and the navigation awaiting it) indefinitely. LLM endpoints are intentionally excluded.
GET /providers embedded every provider's full per-endpoint `resources` array (JSON Schemas included), which made the payload ~18.7MB and ~10s TTFB — the dominant cost of in-app navigation to provider pages. No list consumer reads `resources`. Derive a request-cheap view once when a data source becomes ready: `providersList` strips `resources` from every row (keeping the summary `resourceCount`), and `getProviderById` indexes rows for O(1) lookup. Serve `providersList` from GET /providers.
The provider list is now lightweight (no `resources`), so callers that need a single provider's full payload — including `resources` — fetch it by canonical providerId here. Returns the full catalog row via the data source's `getProviderById`, 404 for unknown ids, 405 for non-GET.
Vercel Preview Deployment
|
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.
No description provided.