fix: regression where clicking anchors on the same page wouldn't set the anchor in the url
This commit is contained in:
		
							parent
							
								
									06426c8f7e
								
							
						
					
					
						commit
						f861a7c160
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -15,7 +15,7 @@ const isLocalUrl = (href: string) => {
 | 
			
		|||
    if (window.location.origin === url.origin) {
 | 
			
		||||
      return true
 | 
			
		||||
    }
 | 
			
		||||
  } catch (e) {}
 | 
			
		||||
  } catch (e) { }
 | 
			
		||||
  return false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -109,6 +109,7 @@ function createRouter() {
 | 
			
		|||
      if (isSamePage(url) && url.hash) {
 | 
			
		||||
        const el = document.getElementById(decodeURIComponent(url.hash.substring(1)))
 | 
			
		||||
        el?.scrollIntoView()
 | 
			
		||||
        history.pushState({}, "", url)
 | 
			
		||||
        return
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue