File tree Expand file tree Collapse file tree 3 files changed +45
-2
lines changed
packages/react-dom/src/client Expand file tree Collapse file tree 3 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import Button from './Button.js';
1212import Form from './Form.js' ;
1313import { Dynamic } from './Dynamic.js' ;
1414import { Client } from './Client.js' ;
15+ import { Navigate } from './Navigate.js' ;
1516
1617import { Note } from './cjs/Note.js' ;
1718
@@ -89,6 +90,7 @@ export default async function App({prerender}) {
8990 < Note />
9091 < Foo > { dedupedChild } </ Foo >
9192 < Bar > { Promise . resolve ( [ dedupedChild ] ) } </ Bar >
93+ < Navigate />
9294 </ Container >
9395 </ body >
9496 </ html >
Original file line number Diff line number Diff line change 1+ 'use client' ;
2+
3+ import * as React from 'react' ;
4+ import Container from './Container.js' ;
5+
6+ export function Navigate ( ) {
7+ /** Repro for https://issues.chromium.org/u/1/issues/419746417 */
8+ function provokeChromeCrash ( ) {
9+ React . startTransition ( async ( ) => {
10+ console . log ( 'Default transition triggered' ) ;
11+
12+ await new Promise ( resolve => {
13+ setTimeout (
14+ ( ) => {
15+ history . pushState (
16+ { } ,
17+ '' ,
18+ `?chrome-crash-419746417=${ performance . now ( ) } `
19+ ) ;
20+ } ,
21+ // This needs to happen before React's default transition indicator
22+ // is displayed but after it's scheduled.
23+ 100 + - 50
24+ ) ;
25+
26+ setTimeout ( ( ) => {
27+ console . log ( 'Default transition completed' ) ;
28+ resolve ( ) ;
29+ } , 1000 ) ;
30+ } ) ;
31+ } ) ;
32+ }
33+
34+ return (
35+ < Container >
36+ < h2 > Navigation fixture</ h2 >
37+ < button onClick = { provokeChromeCrash } > Provoke Chrome Crash (fixed)</ button >
38+ </ Container >
39+ ) ;
40+ }
Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ export function defaultOnDefaultTransitionIndicator(): void | (() => void) {
3838 if ( ! isCancelled ) {
3939 // Some other navigation completed but we should still be running.
4040 // Start another fake one to keep the loading indicator going.
41- startFakeNavigation ( ) ;
41+ // There needs to be an async gap to work around https://issues.chromium.org/u/1/issues/419746417.
42+ setTimeout ( startFakeNavigation , 20 ) ;
4243 }
4344 }
4445
@@ -70,7 +71,7 @@ export function defaultOnDefaultTransitionIndicator(): void | (() => void) {
7071 }
7172 }
7273
73- // Delay the start a bit in case this is a fast navigation .
74+ // Delay the start a bit in case this is a fast Transition .
7475 setTimeout ( startFakeNavigation , 100 ) ;
7576
7677 return function ( ) {
You can’t perform that action at this time.
0 commit comments