Fix Back button going outside the app (#24835)
This commit is contained in:
		
							parent
							
								
									e1ebcc007d
								
							
						
					
					
						commit
						27bafabb64
					
				@ -21,7 +21,10 @@ export default class ColumnBackButton extends React.PureComponent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (onClick) {
 | 
					    if (onClick) {
 | 
				
			||||||
      onClick();
 | 
					      onClick();
 | 
				
			||||||
    } else if (window.history && window.history.state) {
 | 
					    } 
 | 
				
			||||||
 | 
					    // Check if there is a previous page in the app to go back to per https://stackoverflow.com/a/70532858/9703201
 | 
				
			||||||
 | 
					    // When upgrading to V6, check `location.key !== 'default'` instead per https://github.com/remix-run/history/blob/main/docs/api-reference.md#location
 | 
				
			||||||
 | 
					    else if (router.location.key) {
 | 
				
			||||||
      router.history.goBack();
 | 
					      router.history.goBack();
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      router.history.push('/');
 | 
					      router.history.push('/');
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user