File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed 
packages/kit/src/runtime/client Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 1+ --- 
2+ ' @sveltejs/kit '  : patch 
3+ --- 
4+ 
5+ fix: wait for commit promise instead of ` settled ` 
Original file line number Diff line number Diff line change @@ -1689,6 +1689,10 @@ async function navigate({
16891689
16901690	navigation_result . props . page . state  =  state ; 
16911691
1692+ 	/** 
1693+ 	 * @type  {Promise<void> | undefined } 
1694+ 	 */ 
1695+ 	let  commit_promise ; 
16921696	if  ( started )  { 
16931697		const  after_navigate  =  ( 
16941698			await  Promise . all ( 
@@ -1722,7 +1726,7 @@ async function navigate({
17221726		const  fork  =  load_cache_fork  &&  ( await  load_cache_fork ) ; 
17231727
17241728		if  ( fork )  { 
1725- 			void  fork . commit ( ) ; 
1729+ 			commit_promise   =  fork . commit ( ) ; 
17261730		}  else  { 
17271731			root . $set ( navigation_result . props ) ; 
17281732		} 
@@ -1738,9 +1742,9 @@ async function navigate({
17381742	const  promises  =  [ tick ( ) ] ; 
17391743
17401744	// need to render the DOM before we can scroll to the rendered elements and do focus management 
1741- 	// svelte.settled is only available in Svelte 5  
1742- 	if  ( /**  @type  { any } */   ( svelte ) . settled )  { 
1743- 		promises . push ( /**  @type  { any } */   ( svelte ) . settled ( ) ) ; 
1745+ 	// so we wait for the commit if there's one  
1746+ 	if  ( commit_promise )  { 
1747+ 		promises . push ( commit_promise ) ; 
17441748	} 
17451749	// we still need to await tick everytime because if there's no async work settled resolves immediately 
17461750	await  Promise . all ( promises ) ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments