File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -2102,9 +2102,9 @@ export class RouterCore<
21022102
21032103 // Commit the pending matches. If a previous match was
21042104 // removed, place it in the cachedMatches
2105- let exitingMatches ! : Array < AnyRouteMatch >
2106- let enteringMatches ! : Array < AnyRouteMatch >
2107- let stayingMatches ! : Array < AnyRouteMatch >
2105+ let exitingMatches : Array < AnyRouteMatch > = [ ]
2106+ let enteringMatches : Array < AnyRouteMatch > = [ ]
2107+ let stayingMatches : Array < AnyRouteMatch > = [ ]
21082108
21092109 // Wrap batch in framework-specific transition wrapper (e.g., Solid's startTransition)
21102110 this . wrapBatch ( ( ) => {
Original file line number Diff line number Diff line change @@ -39,9 +39,24 @@ export function Transitioner() {
3939 // This ensures state updates that trigger re-renders happen within a transition,
4040 // which prevents Suspense boundaries from showing fallbacks immediately
4141 router . wrapBatch = ( fn : ( ) => void ) => {
42- Solid . startTransition ( ( ) => {
42+ // Only use startTransition if we're in a real browser (not jsdom) AND transitioning
43+ // Check for window.navigator.userAgent to distinguish real browser from jsdom test environment
44+ const isRealBrowser =
45+ typeof window !== 'undefined' &&
46+ typeof window . navigator !== 'undefined' &&
47+ typeof window . navigator . userAgent === 'string' &&
48+ ! window . navigator . userAgent . includes ( 'jsdom' )
49+
50+ if ( isRealBrowser && ! router . isServer && isTransitioning ( ) ) {
51+ // Solid's startTransition executes the callback synchronously
52+ // but marks state updates as transitions
53+ Solid . startTransition ( ( ) => {
54+ fn ( )
55+ } )
56+ } else {
57+ // Fallback for SSR/tests/non-transitions: execute directly
4358 fn ( )
44- } )
59+ }
4560 }
4661
4762 // Track transitioning state but don't wrap the async work in startTransition
You can’t perform that action at this time.
0 commit comments