@@ -23,7 +23,6 @@ import {
2323  ContentInternalContext , 
2424  DocumentHeadContext , 
2525  RouteActionContext , 
26-   RouteInternalContext , 
2726  RouteLocationContext , 
2827  RouteNavigateContext , 
2928  RoutePreventNavigateContext , 
@@ -229,7 +228,7 @@ export const QwikCityProvider = component$<QwikCityProps>((props) => {
229228    // The initial value of routeInternal is derived from the server env, 
230229    // which in the case of SSG may not match the actual origin the site 
231230    // is deployed on. 
232-     if  ( isBrowser  &&  routeInternal . value . type  ===  'initial' )  { 
231+     if  ( isBrowser  &&  type   ===   'link'   &&   routeInternal . value . type  ===  'initial' )  { 
233232      routeInternal . value . dest  =  new  URL ( window . location . href ) ; 
234233    } 
235234
@@ -320,12 +319,12 @@ export const QwikCityProvider = component$<QwikCityProps>((props) => {
320319  useContextProvider ( RouteNavigateContext ,  goto ) ; 
321320  useContextProvider ( RouteStateContext ,  loaderState ) ; 
322321  useContextProvider ( RouteActionContext ,  actionState ) ; 
323-   useContextProvider ( RouteInternalContext ,  routeInternal ) ; 
324322  useContextProvider < any > ( RoutePreventNavigateContext ,  registerPreventNav ) ; 
325323
326324  useTask$ ( ( {  track } )  =>  { 
327325    async  function  run ( )  { 
328-       const  [ navigation ,  action ]  =  track ( ( )  =>  [ routeInternal . value ,  actionState . value ] ) ; 
326+       const  navigation  =  track ( routeInternal ) ; 
327+       const  action  =  track ( actionState ) ; 
329328
330329      const  locale  =  getLocale ( '' ) ; 
331330      const  prevUrl  =  routeLocation . url ; 
@@ -387,6 +386,7 @@ export const QwikCityProvider = component$<QwikCityProps>((props) => {
387386        try  { 
388387          loadedRoute  =  await  loadRoutePromise ; 
389388        }  catch  ( e )  { 
389+           console . error ( e ) ; 
390390          window . location . href  =  newHref ; 
391391          return ; 
392392        } 
@@ -523,7 +523,7 @@ export const QwikCityProvider = component$<QwikCityProps>((props) => {
523523            // Firefox only does it once and no more, but will still scroll. It also sets state to null. 
524524            // Any <a> tags w/ #hash href will break SPA state in Firefox. 
525525            // We patch these events and direct them to Link pipeline during SPA. 
526-             document . body . addEventListener ( 'click' ,  ( event )  =>  { 
526+             document . addEventListener ( 'click' ,  ( event )  =>  { 
527527              if  ( event . defaultPrevented )  { 
528528                return ; 
529529              } 
@@ -561,7 +561,7 @@ export const QwikCityProvider = component$<QwikCityProps>((props) => {
561561              } 
562562            } ) ; 
563563
564-             document . body . removeEventListener ( 'click' ,  win . _qCityInitAnchors ! ) ; 
564+             document . removeEventListener ( 'click' ,  win . _qCityInitAnchors ! ) ; 
565565            win . _qCityInitAnchors  =  undefined ; 
566566
567567            // TODO Remove block after Navigation API PR. 
@@ -678,7 +678,6 @@ export const QwikCityMockProvider = component$<QwikCityMockProps>((props) => {
678678  ) ; 
679679
680680  const  loaderState  =  useSignal ( { } ) ; 
681-   const  routeInternal  =  useSignal < RouteStateInternal > ( {  type : 'initial' ,  dest : url  } ) ; 
682681
683682  const  goto : RouteNavigate  = 
684683    props . goto  ?? 
@@ -707,7 +706,6 @@ export const QwikCityMockProvider = component$<QwikCityMockProps>((props) => {
707706  useContextProvider ( RouteNavigateContext ,  goto ) ; 
708707  useContextProvider ( RouteStateContext ,  loaderState ) ; 
709708  useContextProvider ( RouteActionContext ,  actionState ) ; 
710-   useContextProvider ( RouteInternalContext ,  routeInternal ) ; 
711709
712710  return  < Slot  /> ; 
713711} ) ; 
0 commit comments