mirror of
https://github.com/cloudflare/vinext.git
synced 2026-09-14 19:04:59 +08:00
835e6b9943
* fix(app-router): suppress redirect console errors in production onCaughtError (#1830) When redirect() is called from a 'use client' root layout (or any client component), React catches the NEXT_REDIRECT sentinel via RedirectErrorBoundary and then calls the hydrateRoot onCaughtError callback. In dev mode vinext already filtered these via devOnCaughtError, but the production path had no onCaughtError at all — React's built-in fallback calls console.error, producing a spurious browser console error that fails the Next.js compat test assertion `expect(foundErrors).toBe(false)`. Fix: add prodOnCaughtError to app-browser-error.ts that silently drops navigation signal errors (NEXT_REDIRECT, NEXT_NOT_FOUND, NEXT_HTTP_ERROR_FALLBACK) and logs all other caught errors, preserving React's default behavior. Add fixture tests/fixtures/root-layout-redirect/ (dedicated 'use client' root layout with redirect()) and Playwright project root-layout-redirect (port 4184) with spec porting the Next.js root-layout-redirect > should work using browser. Part of #1830 * fix: include result/ page in root-layout-redirect fixture * fix: add lockfile entry for root-layout-redirect fixture, use prod server, import isNavigationSignalError Three fixes to unblock catastrophically-failing CI: 1. pnpm-lock.yaml: Add missing importer entry for tests/fixtures/root-layout-redirect. The fixture was added without updating the lockfile, causing ERR_PNPM_OUTDATED_LOCKFILE on every CI job during `vp install`. 2. playwright.config.ts: Switch the root-layout-redirect server from `npx vp dev` (dev mode) to `vinext build + vinext start` (production mode). The fix under test — prodOnCaughtError — is only active in production builds; running in dev mode exercised the pre-existing devOnCaughtError path and never touched the new code. 3. app-browser-error.ts: Replace the inline isNavigationSignalDigest helper with an import of isNavigationSignalError from utils/navigation-signal.ts. The module is dependency-free and already in the production browser bundle; inlining it reintroduced the drift risk that navigation-signal.ts was created to prevent. Addresses ask-bonk findings: blocking (test ran in dev mode) and maintainability (inline classifier duplication). * test: add prodOnCaughtError unit tests, run root-layout-redirect e2e in CI, scope gitignore negation
55 lines
802 B
Plaintext
55 lines
802 B
Plaintext
node_modules/
|
|
dist/
|
|
out/
|
|
*.tsbuildinfo
|
|
.vite/
|
|
.turbo/
|
|
.ecosystem-test/
|
|
.next/
|
|
.wrangler/
|
|
test-results/
|
|
playwright-report/
|
|
out-e2e
|
|
|
|
# Environment + secrets
|
|
.env
|
|
.env.*
|
|
!.env.example
|
|
# wrangler convention for local-only secrets passed to `wrangler dev`
|
|
.dev.vars
|
|
.dev.vars.*
|
|
|
|
# Logs / coverage
|
|
*.log
|
|
npm-debug.log*
|
|
yarn-debug.log*
|
|
yarn-error.log*
|
|
pnpm-debug.log*
|
|
coverage/
|
|
reports/
|
|
|
|
# Worktrees
|
|
.worktrees/
|
|
.claude
|
|
|
|
# Next.js reference clone (for searching source/tests)
|
|
.nextjs-ref/
|
|
|
|
# OS / editor
|
|
.DS_Store
|
|
.idea/
|
|
.vscode/
|
|
.claude/
|
|
|
|
# Nix
|
|
result
|
|
result-*
|
|
# The Nix `result` pattern above also matches Next.js compat fixture routes
|
|
# named `result`; re-include them so they don't silently fall out of tracking.
|
|
!tests/fixtures/root-layout-redirect/app/result/
|
|
.direnv/
|
|
.corepack/
|
|
|
|
.vinext
|
|
next-env.d.ts
|