File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
packages/solid-router/src Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -36,14 +36,19 @@ export function Transitioner() {
3636 const previousIsPagePending = usePrevious ( isPagePending )
3737
3838 router . startTransition = ( fn : ( ) => void | Promise < void > ) => {
39- setIsTransitioning ( true )
40- Solid . startTransition ( async ( ) => {
41- try {
42- await fn ( )
43- } finally {
44- setIsTransitioning ( false )
45- }
39+ // Execute fn synchronously to check if it returns a Promise
40+ let result : void | Promise < void >
41+ Solid . startTransition ( ( ) => {
42+ result = fn ( )
4643 } )
44+
45+ // If fn returned a Promise, track the transition state
46+ if ( result ! instanceof Promise ) {
47+ setIsTransitioning ( true )
48+ result . finally ( ( ) => {
49+ setIsTransitioning ( false )
50+ } )
51+ }
4752 }
4853
4954 // Subscribe to location changes
You can’t perform that action at this time.
0 commit comments