File tree Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Original file line number Diff line number Diff line change 1- import { JSX , Accessor } from "solid-js" ;
1+ import { JSX , Accessor , getOwner , runWithOwner } from "solid-js" ;
22import {
33 createComponent ,
44 createContext ,
@@ -330,6 +330,8 @@ export function createRouterContext(
330330 } ) ;
331331 } ) ;
332332
333+ const owner = getOwner ( ) ;
334+
333335 return {
334336 base : baseRoute ,
335337 location,
@@ -440,20 +442,23 @@ export function createRouterContext(
440442 route . component &&
441443 ( route . component as MaybePreloadableComponent ) . preload &&
442444 ( route . component as MaybePreloadableComponent ) . preload ! ( ) ;
445+ const { load } = route ;
443446 preloadData &&
444- route . load &&
445- route . load ( {
446- params,
447- location : {
448- pathname : url . pathname ,
449- search : url . search ,
450- hash : url . hash ,
451- query : extractSearchParams ( url ) ,
452- state : null ,
453- key : ""
454- } ,
455- intent : "preload"
456- } ) ;
447+ load &&
448+ runWithOwner ( owner , ( ) =>
449+ load ( {
450+ params,
451+ location : {
452+ pathname : url . pathname ,
453+ search : url . search ,
454+ hash : url . hash ,
455+ query : extractSearchParams ( url ) ,
456+ state : null ,
457+ key : ""
458+ } ,
459+ intent : "preload"
460+ } )
461+ ) ;
457462 }
458463 intent = prevIntent ;
459464 }
You can’t perform that action at this time.
0 commit comments