File tree Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Original file line number Diff line number Diff line change 33 < head >
44 < meta charset ="UTF-8 " />
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6- < title > Redirecting ...</ title >
6+ < title > Loading ...</ title >
77 < script >
8- // Single Page Application redirect for GitHub Pages
9- // This redirects all routes to index.html so React Router can handle them
10- const pathSegmentsToKeep = 1 ;
11- const l = window . location ;
12- l . replace (
13- l . protocol + '//' + l . hostname + ( l . port ? ':' + l . port : '' ) +
14- l . pathname . split ( '/' ) . slice ( 0 , 1 + pathSegmentsToKeep ) . join ( '/' ) +
15- '/?/' + l . pathname . slice ( 1 ) . split ( '/' ) . slice ( pathSegmentsToKeep ) . join ( '/' ) . replace ( / & / g, '~and~' ) +
16- ( l . search ? '&' + l . search . slice ( 1 ) . replace ( / & / g, '~and~' ) : '' ) +
17- l . hash
18- ) ;
8+ // Surge serves 404.html for unknown routes unless a 200 fallback is provided.
9+ // Instead of mutating the URL (which produced /?/… redirects), load the main
10+ // SPA shell in-place so React Router can hydrate the correct route.
11+ fetch ( '/index.html' , { credentials : 'same-origin' } )
12+ . then ( ( response ) => response . text ( ) )
13+ . then ( ( html ) => {
14+ document . open ( ) ;
15+ document . write ( html ) ;
16+ document . close ( ) ;
17+ } )
18+ . catch ( ( ) => {
19+ window . location . replace ( '/' ) ;
20+ } ) ;
1921 </ script >
2022 </ head >
2123 < body >
22- < p > Redirecting to the app... </ p >
24+ < p > Loading the application… </ p >
2325 </ body >
2426</ html >
You can’t perform that action at this time.
0 commit comments