diff --git a/packages/app/src/components/PagePanels/index.jsx b/packages/app/src/components/PagePanels/index.jsx index 1ce47613..339f0942 100755 --- a/packages/app/src/components/PagePanels/index.jsx +++ b/packages/app/src/components/PagePanels/index.jsx @@ -48,7 +48,7 @@ export const Panel = (props) => { export class PagePanelWithNavMenu extends React.Component { state = { - activeTab: new URLSearchParams(window.location.search).get("type") ?? this.props.defaultTab ?? this.props.tabs[0].key, + activeTab: new URLSearchParams(window.location.hash.replace("#", "?")).get("type") ?? this.props.defaultTab ?? this.props.tabs[0].key, renders: [], } @@ -157,7 +157,7 @@ export class PagePanelWithNavMenu extends React.Component { } replaceQueryTypeToCurrentTab = (key) => { - app.history.replace(`${window.location.pathname}?type=${key ?? this.state.activeTab}`) + document.location.hash = `type=${key ?? this.state.activeTab}` } tabChange = async (key) => { diff --git a/packages/app/src/hooks/useUrlQueryActiveKey/index.js b/packages/app/src/hooks/useUrlQueryActiveKey/index.js index 4943680a..50d0602d 100755 --- a/packages/app/src/hooks/useUrlQueryActiveKey/index.js +++ b/packages/app/src/hooks/useUrlQueryActiveKey/index.js @@ -4,15 +4,15 @@ export default ({ defaultKey = "0", queryKey = "key", }) => { - const [activeKey, setActiveKey] = React.useState(new URLSearchParams(window.location.search).get(queryKey) ?? defaultKey) + const [activeKey, setActiveKey] = React.useState(new URLSearchParams(window.location.hash.replace("#", "?")).get(queryKey) ?? defaultKey) const replaceQueryTypeToCurrentTab = (key) => { if (!key) { // delete query - return app.history.replace(window.location.pathname) + return document.location.hash = null } - return app.history.replace(`${window.location.pathname}?${queryKey}=${key}`) + return document.location.hash = `${queryKey}=${key}` } const changeActiveKey = (key) => {