fix #52: correct the StackedRouter on 'replace'
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				/ depoly (push) Successful in 1m26s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	/ depoly (push) Successful in 1m26s
				
			This commit is contained in:
		
							parent
							
								
									ee67993796
								
							
						
					
					
						commit
						ee31c38f32
					
				
					 5 changed files with 61 additions and 25 deletions
				
			
		| 
						 | 
				
			
			@ -4,6 +4,7 @@ import {
 | 
			
		|||
  createMemo,
 | 
			
		||||
  createRenderEffect,
 | 
			
		||||
  createResource,
 | 
			
		||||
  untrack,
 | 
			
		||||
  useContext,
 | 
			
		||||
} from "solid-js";
 | 
			
		||||
import { Account } from "../accounts/stores";
 | 
			
		||||
| 
						 | 
				
			
			@ -57,15 +58,15 @@ export const Provider = Context.Provider;
 | 
			
		|||
 | 
			
		||||
export function useSessions() {
 | 
			
		||||
  const sessions = useSessionsRaw();
 | 
			
		||||
  const {push} = useNavigator();
 | 
			
		||||
  const { push } = useNavigator();
 | 
			
		||||
  const location = useLocation();
 | 
			
		||||
 | 
			
		||||
  createRenderEffect(() => {
 | 
			
		||||
    if (sessions().length > 0) return;
 | 
			
		||||
    push(
 | 
			
		||||
      "/accounts/sign-in?back=" + encodeURIComponent(location.pathname),
 | 
			
		||||
      { replace: "all" },
 | 
			
		||||
    );
 | 
			
		||||
    if (untrack(() => sessions().length) > 0) return;
 | 
			
		||||
 | 
			
		||||
    push("/accounts/sign-in?back=" + encodeURIComponent(location.pathname), {
 | 
			
		||||
      replace: true,
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  return sessions;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue