File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -2131,18 +2131,19 @@ export class RouterCore<
21312131 } )
21322132 this . clearExpiredCache ( )
21332133 } )
2134- } )
21352134
2136- //
2137- ; (
2138- [
2139- [ exitingMatches , 'onLeave' ] ,
2140- [ enteringMatches , 'onEnter' ] ,
2141- [ stayingMatches , 'onStay' ] ,
2142- ] as const
2143- ) . forEach ( ( [ matches , hook ] ) => {
2144- matches . forEach ( ( match ) => {
2145- this . looseRoutesById [ match . routeId ] ! . options [ hook ] ?.( match )
2135+ // Call lifecycle hooks inside the transition so they execute synchronously
2136+ // even when startTransition is async (e.g., in Solid)
2137+ ; (
2138+ [
2139+ [ exitingMatches , 'onLeave' ] ,
2140+ [ enteringMatches , 'onEnter' ] ,
2141+ [ stayingMatches , 'onStay' ] ,
2142+ ] as const
2143+ ) . forEach ( ( [ matches , hook ] ) => {
2144+ matches . forEach ( ( match ) => {
2145+ this . looseRoutesById [ match . routeId ] ! . options [ hook ] ?.( match )
2146+ } )
21462147 } )
21472148 } )
21482149 } )
You can’t perform that action at this time.
0 commit comments