fix(tripwire): share aggregates promise across Suspense leaves#34
Merged
Conversation
The /x/tripwire page had two async server components (HeroLive and StatsLive) that each independently called getAggregates(). React renders them in parallel, so on a cold module cache both fired @vercel/blob's head() simultaneously. Under Bun on Vercel, the SDK's internal `await apiResponse.json()` after its Response goes out of scope can leave one of those parallel calls stuck waiting for EOF — its Suspense boundary then sat on its skeleton forever. A reload warmed the cache and both rendered. Two changes that converge on the fix: 1. The page kicks off getAggregates() once (without awaiting) and passes the promise to both leaves. One network call, both boundaries reveal together when the data lands. Page shell still streams immediately because the page itself isn't async. 2. aggregates.ts and stats.ts now construct the private blob URL from BLOB_READ_WRITE_TOKEN's storeId instead of calling head() to resolve it. The bearer-token fetch is the path we already know works on Bun-on-Vercel. No SDK call to hang on.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
The /x/tripwire page had two async server components (
HeroLiveandStatsLive) that each calledgetAggregates()independently. React renders them in parallel, so on a cold module cache both fired@vercel/blob'shead()simultaneously. Under Bun on Vercel the SDK's internalawait apiResponse.json()after its Response goes out of scope can leave one of those parallel calls stuck waiting for EOF — its Suspense boundary then sat on its skeleton forever. A reload warmed the cache and both rendered.Two changes:
getAggregates()once (without awaiting) and passes the promise to both leaves. One network call, both boundaries reveal together when the data lands. Page shell still streams immediately because the page itself isn'tasync.aggregates.tsandstats.tsconstruct the private blob URL fromBLOB_READ_WRITE_TOKEN's storeId instead of callinghead()to resolve it. The bearer-token fetch is the path we already know works on Bun-on-Vercel. No SDK call to hang on.Generated by Claude Code