fix: jump to anchor on deployed site triggering spa refresh

This commit is contained in:
Jacky Zhao 2023-08-20 17:50:56 -07:00
parent 1d5d088c86
commit 95b9358c0d

View File

@ -94,6 +94,7 @@ function createRouter() {
window.addEventListener("click", async (event) => { window.addEventListener("click", async (event) => {
const { url } = getOpts(event) ?? {} const { url } = getOpts(event) ?? {}
if (!url) return if (!url) return
if (url.pathname === window.location.pathname) return
event.preventDefault() event.preventDefault()
try { try {
navigate(url, false) navigate(url, false)