Skip to content

Add automatic request-ID propagation for Suspense - #515

Merged
arthurfiorette merged 2 commits into
nextfrom
arthurfiorette/store
Jul 16, 2026
Merged

Add automatic request-ID propagation for Suspense#515
arthurfiorette merged 2 commits into
nextfrom
arthurfiorette/store

Conversation

@arthurfiorette

@arthurfiorette arthurfiorette commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

  • add AutoSuspense for boundaries that obtain their request ID from an automatic Suspense scope
  • add the opt-in autoSuspense option to the Express and Fastify integrations
  • preserve the existing Suspense API with its required explicit rid
  • isolate concurrent request scopes across awaited route handlers
  • document automatic and explicit Suspense usage
  • raise the @kitajs/html Node.js minimum to 12.17 for AsyncLocalStorage

Implementation

Framework integrations establish the automatic scope before route JSX is evaluated. AutoSuspense reads the request ID from that scope and throws with setup guidance when no scope is active. Regular Suspense remains unchanged for users who prefer explicit request IDs.

Testing

  • pnpm format
  • pnpm build
  • pnpm test-types
  • pnpm test
  • pnpm -F @kitajs/docs-html build

Includes core, Express, and Fastify coverage for missing scopes, missing request IDs, type safety, awaited handlers, and concurrent request isolation.

@changeset-bot

changeset-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d95c304

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@kitajs/html Minor
@kitajs/fastify-html-plugin Minor
@kitajs/express-html-plugin Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@arthurfiorette arthurfiorette changed the title code Add automatic request-ID propagation for Suspense Jul 16, 2026
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.54%. Comparing base (b46042c) to head (d95c304).

Additional details and impacted files
@@            Coverage Diff             @@
##             next     #515      +/-   ##
==========================================
+ Coverage   95.40%   95.54%   +0.13%     
==========================================
  Files          13       13              
  Lines         479      494      +15     
  Branches      137      141       +4     
==========================================
+ Hits          457      472      +15     
  Misses         20       20              
  Partials        2        2              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arthurfiorette
arthurfiorette merged commit a7b48fd into next Jul 16, 2026
9 checks passed
@arthurfiorette
arthurfiorette deleted the arthurfiorette/store branch July 16, 2026 13:21
@github-actions github-actions Bot mentioned this pull request Jul 16, 2026
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.

1 participant