[PR #950] [MERGED] fix: add tests verifying strings thrown in Server Components are not swallowed #978

Closed
opened 2026-05-06 13:11:21 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/950
Author: @Divkix
Created: 4/29/2026
Status: Merged
Merged: 4/29/2026
Merged by: @james-elicx

Base: mainHead: fix/810-string-error-handling


📝 Commits (2)

  • 63f4441 fix: add tests verifying strings thrown in Server Components are not swallowed (#810)
  • 295a490 fix: address review feedback on string error handling tests (#950)

📊 Changes

3 files changed (+56 additions, -2 deletions)

View changed files

📝 tests/app-router.test.ts (+33 -2)
tests/fixtures/app-basic/app/throw-string-test/error.tsx (+19 -0)
tests/fixtures/app-basic/app/throw-string-test/page.tsx (+4 -0)

📄 Description

Fixes #810

Summary

  • vinext's rscOnError already correctly handles strings thrown in Server Components — no early-return swallow bug exists (unlike the Next.js bug fixed in vercel/next.js@b9ca95c62)
  • Added fixture page (throw-string-test) that throws a string in a Server Component with an error boundary
  • Added integration test verifying the error boundary renders with the string message
  • Added runtime test confirming rscOnError returns a valid digest hash for string throws in production
  • Added static test confirming generated code has no typeof thrownValue === 'string' early-return path

Test plan

  • Integration test: error boundary catches string thrown in Server Component and displays the message
  • Runtime test: rscOnError processes string throws through normal error path (produces digest in production)
  • Static test: generated code free of the string early-return anti-pattern

Upstream: github.com/vercel/next.js@b9ca95c62d


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/950 **Author:** [@Divkix](https://github.com/Divkix) **Created:** 4/29/2026 **Status:** ✅ Merged **Merged:** 4/29/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/810-string-error-handling` --- ### 📝 Commits (2) - [`63f4441`](https://github.com/cloudflare/vinext/commit/63f4441a8c229d4ee5543a348bf2896ff833a3cf) fix: add tests verifying strings thrown in Server Components are not swallowed (#810) - [`295a490`](https://github.com/cloudflare/vinext/commit/295a49089fb420a74c780db9ab7ed4c51b353b69) fix: address review feedback on string error handling tests (#950) ### 📊 Changes **3 files changed** (+56 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/app-router.test.ts` (+33 -2) ➕ `tests/fixtures/app-basic/app/throw-string-test/error.tsx` (+19 -0) ➕ `tests/fixtures/app-basic/app/throw-string-test/page.tsx` (+4 -0) </details> ### 📄 Description Fixes #810 ## Summary - vinext's `rscOnError` already correctly handles strings thrown in Server Components — no early-return swallow bug exists (unlike the Next.js bug fixed in vercel/next.js@b9ca95c62) - Added fixture page (`throw-string-test`) that throws a string in a Server Component with an error boundary - Added integration test verifying the error boundary renders with the string message - Added runtime test confirming `rscOnError` returns a valid digest hash for string throws in production - Added static test confirming generated code has no `typeof thrownValue === 'string'` early-return path ## Test plan - Integration test: error boundary catches string thrown in Server Component and displays the message - Runtime test: `rscOnError` processes string throws through normal error path (produces digest in production) - Static test: generated code free of the string early-return anti-pattern Upstream: https://github.com/vercel/next.js/commit/b9ca95c62dd882eb3c0e5fc0be9b20bf0b198fb1 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:11:21 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#978
No description provided.