Skip to content

Parallelize SSR fetches on the Popular page#2418

Merged
Simek merged 1 commit intoreact-native-community:mainfrom
azizbecha:fix/parallelize-popular-ssr-fetches
Apr 29, 2026
Merged

Parallelize SSR fetches on the Popular page#2418
Simek merged 1 commit intoreact-native-community:mainfrom
azizbecha:fix/parallelize-popular-ssr-fetches

Conversation

@azizbecha
Copy link
Copy Markdown
Contributor

Summary

  • Follow-up to Parallelize SSR fetches on the home page #2416 as suggested in review.
  • pages/popular.tsx was awaiting twelve ssrFetch calls sequentially in getInitialProps (one per platform), then awaiting each .json() one at a time. The fetches don't depend on each other.
  • Fan them out with Promise.all for both the requests and the JSON parses.

Test plan

  • bunx oxlint pages/popular.tsx — clean
  • bunx oxfmt --check pages/popular.tsx — clean
  • bun start and load /popular locally; dev-server log shows all twelve /api/libraries?... requests issued in the same window instead of stacked sequentially. Warm renders return in ~26ms with all twelve API calls completing in ~15ms each, in parallel. No runtime errors.

Same pattern as react-native-community#2416, applied to pages/popular.tsx which was
awaiting twelve ssrFetch calls sequentially in getInitialProps,
then awaiting each .json() one at a time. Fan them out with
Promise.all so the requests collapse into a single roundtrip's
worth of latency.
Copy link
Copy Markdown
Member

@Simek Simek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow up, LGTM! 🚀

@Simek Simek merged commit e5eec97 into react-native-community:main Apr 29, 2026
1 check passed
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.

2 participants