@@ -5,6 +5,14 @@ import path from 'path'
55import { outdent } from 'outdent'
66import { getToastErrorCount , retry } from 'next-test-utils'
77
8+ const enableNewScrollHandler = Boolean (
9+ process . env . __NEXT_EXPERIMENTAL_APP_NEW_SCROLL_HANDLER
10+ )
11+
12+ const innerScrollAndFocusHandlerName = enableNewScrollHandler
13+ ? 'InnerScrollAndFocusHandlerNew'
14+ : 'InnerScrollAndFocusHandlerOld'
15+
816describe ( 'Error overlay for hydration errors in App router' , ( ) => {
917 const { next, isTurbopack } = nextTestSetup ( {
1018 files : new FileRef ( path . join ( __dirname , 'fixtures' , 'default-template' ) ) ,
@@ -74,7 +82,7 @@ describe('Error overlay for hydration errors in App router', () => {
7482 {
7583 "componentStack": "...
7684 <ScrollAndFocusHandler segmentPath={[...]}>
77- <InnerScrollAndFocusHandler segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
85+ <${ innerScrollAndFocusHandlerName } segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
7886 <ErrorBoundary errorComponent={undefined} errorStyles={undefined} errorScripts={undefined}>
7987 <LoadingBoundary loading={null}>
8088 <HTTPAccessFallbackBoundary notFound={<SegmentViewNode>} forbidden={undefined} unauthorized={undefined}>
@@ -154,7 +162,7 @@ describe('Error overlay for hydration errors in App router', () => {
154162 {
155163 "componentStack": "...
156164 <ScrollAndFocusHandler segmentPath={[...]}>
157- <InnerScrollAndFocusHandler segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
165+ <${ innerScrollAndFocusHandlerName } segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
158166 <ErrorBoundary errorComponent={undefined} errorStyles={undefined} errorScripts={undefined}>
159167 <LoadingBoundary loading={null}>
160168 <HTTPAccessFallbackBoundary notFound={<SegmentViewNode>} forbidden={undefined} unauthorized={undefined}>
@@ -311,7 +319,7 @@ describe('Error overlay for hydration errors in App router', () => {
311319 {
312320 "componentStack": "...
313321 <ScrollAndFocusHandler segmentPath={[...]}>
314- <InnerScrollAndFocusHandler segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
322+ <${ innerScrollAndFocusHandlerName } segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
315323 <ErrorBoundary errorComponent={undefined} errorStyles={undefined} errorScripts={undefined}>
316324 <LoadingBoundary loading={null}>
317325 <HTTPAccessFallbackBoundary notFound={<SegmentViewNode>} forbidden={undefined} unauthorized={undefined}>
@@ -372,7 +380,7 @@ describe('Error overlay for hydration errors in App router', () => {
372380 "componentStack": "...
373381 <RenderFromTemplateContext>
374382 <ScrollAndFocusHandler segmentPath={[...]}>
375- <InnerScrollAndFocusHandler segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
383+ <${ innerScrollAndFocusHandlerName } segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
376384 <ErrorBoundary errorComponent={undefined} errorStyles={undefined} errorScripts={undefined}>
377385 <LoadingBoundary loading={null}>
378386 <HTTPAccessFallbackBoundary notFound={<SegmentViewNode>} forbidden={undefined} unauthorized={undefined}>
@@ -426,7 +434,7 @@ describe('Error overlay for hydration errors in App router', () => {
426434 "componentStack": "...
427435 <RenderFromTemplateContext>
428436 <ScrollAndFocusHandler segmentPath={[...]}>
429- <InnerScrollAndFocusHandler segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
437+ <${ innerScrollAndFocusHandlerName } segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
430438 <ErrorBoundary errorComponent={undefined} errorStyles={undefined} errorScripts={undefined}>
431439 <LoadingBoundary loading={null}>
432440 <HTTPAccessFallbackBoundary notFound={<SegmentViewNode>} forbidden={undefined} unauthorized={undefined}>
@@ -488,7 +496,7 @@ describe('Error overlay for hydration errors in App router', () => {
488496 [
489497 {
490498 "componentStack": "...
491- <InnerScrollAndFocusHandler segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
499+ <${ innerScrollAndFocusHandlerName } segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
492500 <ErrorBoundary errorComponent={undefined} errorStyles={undefined} errorScripts={undefined}>
493501 <LoadingBoundary loading={null}>
494502 <HTTPAccessFallbackBoundary notFound={<SegmentViewNode>} forbidden={undefined} unauthorized={undefined}>
@@ -523,7 +531,7 @@ describe('Error overlay for hydration errors in App router', () => {
523531 "componentStack": "...
524532 <RenderFromTemplateContext>
525533 <ScrollAndFocusHandler segmentPath={[...]}>
526- <InnerScrollAndFocusHandler segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
534+ <${ innerScrollAndFocusHandlerName } segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
527535 <ErrorBoundary errorComponent={undefined} errorStyles={undefined} errorScripts={undefined}>
528536 <LoadingBoundary loading={null}>
529537 <HTTPAccessFallbackBoundary notFound={<SegmentViewNode>} forbidden={undefined} unauthorized={undefined}>
@@ -582,7 +590,7 @@ describe('Error overlay for hydration errors in App router', () => {
582590 "componentStack": "...
583591 <RenderFromTemplateContext>
584592 <ScrollAndFocusHandler segmentPath={[...]}>
585- <InnerScrollAndFocusHandler segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
593+ <${ innerScrollAndFocusHandlerName } segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
586594 <ErrorBoundary errorComponent={undefined} errorStyles={undefined} errorScripts={undefined}>
587595 <LoadingBoundary loading={null}>
588596 <HTTPAccessFallbackBoundary notFound={<SegmentViewNode>} forbidden={undefined} unauthorized={undefined}>
@@ -741,7 +749,7 @@ describe('Error overlay for hydration errors in App router', () => {
741749 "componentStack": "...
742750 <RenderFromTemplateContext>
743751 <ScrollAndFocusHandler segmentPath={[...]}>
744- <InnerScrollAndFocusHandler segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
752+ <${ innerScrollAndFocusHandlerName } segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
745753 <ErrorBoundary errorComponent={undefined} errorStyles={undefined} errorScripts={undefined}>
746754 <LoadingBoundary loading={null}>
747755 <HTTPAccessFallbackBoundary notFound={<SegmentViewNode>} forbidden={undefined} unauthorized={undefined}>
@@ -821,7 +829,7 @@ describe('Error overlay for hydration errors in App router', () => {
821829 [
822830 {
823831 "componentStack": "...
824- <InnerScrollAndFocusHandler segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
832+ <${ innerScrollAndFocusHandlerName } segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
825833 <ErrorBoundary errorComponent={undefined} errorStyles={undefined} errorScripts={undefined}>
826834 <LoadingBoundary loading={null}>
827835 <HTTPAccessFallbackBoundary notFound={<SegmentViewNode>} forbidden={undefined} unauthorized={undefined}>
@@ -896,7 +904,7 @@ describe('Error overlay for hydration errors in App router', () => {
896904 "componentStack": "...
897905 <RenderFromTemplateContext>
898906 <ScrollAndFocusHandler segmentPath={[...]}>
899- <InnerScrollAndFocusHandler segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
907+ <${ innerScrollAndFocusHandlerName } segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
900908 <ErrorBoundary errorComponent={undefined} errorStyles={undefined} errorScripts={undefined}>
901909 <LoadingBoundary loading={null}>
902910 <HTTPAccessFallbackBoundary notFound={<SegmentViewNode>} forbidden={undefined} unauthorized={undefined}>
@@ -972,7 +980,7 @@ describe('Error overlay for hydration errors in App router', () => {
972980 "componentStack": "...
973981 <RenderFromTemplateContext>
974982 <ScrollAndFocusHandler segmentPath={[...]}>
975- <InnerScrollAndFocusHandler segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
983+ <${ innerScrollAndFocusHandlerName } segmentPath={[...]} focusAndScrollRef={{apply:false, ...}}>
976984 <ErrorBoundary errorComponent={undefined} errorStyles={undefined} errorScripts={undefined}>
977985 <LoadingBoundary loading={null}>
978986 <HTTPAccessFallbackBoundary notFound={<SegmentViewNode>} forbidden={undefined} unauthorized={undefined}>
0 commit comments