Commit 300654e786

300654e78636d008b8c9162230b75be132c50144

parent: e217236081

Unsigned

taskylizard <75871323+taskylizard@users.noreply.github.com> · 2026-06-12 10:02 UTC

fix: double pushState in tabs

Layout: unified · split

docs/.vitepress/theme/Layout.vue +18 −4
@@ -711,10 +711,24 @@ onMounted(() => {
711711 const tabFromHash = raw.startsWith('#' + TAB_LINK_MARKER)
712712 ? raw.slice(1 + TAB_LINK_MARKER.length)
713713 : null
714 const tabFromQuery =
715 !tabFromHash && raw.includes(`?${TAB_QUERY_PARAM}=`) && !raw.includes('#')
716 ? new URLSearchParams(raw.split('?')[1]).get(TAB_QUERY_PARAM)
717 : null
714 let tabFromQuery: string | null = null
715 if (
716 !e.defaultPrevented &&
717 !tabFromHash &&
718 raw.includes(`?${TAB_QUERY_PARAM}=`) &&
719 !raw.includes('#')
720 ) {
721 try {
722 const url = new URL(raw, window.location.href)
723 const samePage = url.origin === window.location.origin &&
724 url.pathname === window.location.pathname
725 tabFromQuery = samePage
726 ? url.searchParams.get(TAB_QUERY_PARAM)
727 : null
728 } catch {
729 tabFromQuery = null
730 }
731 }
718732 const tabName = tabFromHash ?? tabFromQuery
719733
720734 if (tabName) {