next.js
613f0d1b - Reimplement static shell validation in terms of instant validation

Commit
4 days ago
Reimplement static shell validation in terms of instant validation When a route has instant validation enabled (needsInstantValidation === true), static shell validation now runs through the instant validation infrastructure as a navigation with null parent (entire tree is new) instead of using the legacy staged shell validation path. Key changes: - Support null navigationParent in instant validation to represent SSV - Add isStaticShellValidation flag to track SSV-specific behavior - Detect sync IO (Date.now(), Math.random()) in client components during SSV - Detect Suspense-above-body pattern to allow empty shells - Wire SSV-in-IV in validateInstantConfigs with two-pass discrimination - Add abortAndThrowOnSynchronousPlatformIOAccess for sync IO detection - Handle SSV component stacks without PrefetchValidationBoundary Tests cover: clean static shell, sync IO detection, Suspense above body, dynamic viewport errors, Suspense around dynamic content, and allowEmptyStaticShell early return. Flatten static shell validation tests into individual directories Split the multi-fixture `instant-validation-static-shells/` directory into 8 independent test directories under `test/e2e/app-dir/`, each with a single `nextTestSetup({ files: __dirname })` and no fixtures subdirectory. New directories all use the `instant-static-shell-validation-` prefix. Remove redundant valid-clean test This scenario is already covered by the instant-validation test suite which tests valid static pages with unstable_instant config. Remove overlapping static shell validation tests blocking-below-static and dynamic-viewport test the same rules already covered by the instant-validation suite (invalid-blocking-inside-static and invalid-runtime-viewport-in-static). Restore original instant-validation-static-shells test The original test file and its fixtures (valid/, invalid-blocking-page-below-static/) were pre-existing and should not have been moved. Restore them to their original location and remove the flattened opting-out directory. Fix type error: use addErrorContext instead of nonexistent function Replace call to undefined createErrorWithComponentOrOwnerStack with the existing addErrorContext helper. Remove 'as const' from unstable_instant exports in test fixtures The 'as const' type assertion causes invalid segment configuration errors during build. Match the pattern used by existing fixtures. Fix snapshot mismatches in static shell validation tests Update error code E1084 → E1087 and add missing E394 code field.
Author
Committer
Parents
Loading