Просмотр исходного кода

fix edit button for Custom Sidebar

Yuki Takei 3 лет назад
Родитель
Сommit
419cde5dc3

+ 1 - 1
packages/app/src/components/Sidebar/CustomSidebar.tsx

@@ -47,7 +47,7 @@ const CustomSidebar: FC = () => {
       <div className="grw-sidebar-content-header py-3 d-flex">
       <div className="grw-sidebar-content-header py-3 d-flex">
         <h3 className="mb-0">
         <h3 className="mb-0">
           {t('CustomSidebar')}
           {t('CustomSidebar')}
-          <Link href="/Sidebar"><a className="h6 ml-2"><i className="icon-pencil"></i></a></Link>
+          <Link href="/Sidebar#edit"><a className="h6 ml-2"><i className="icon-pencil"></i></a></Link>
         </h3>
         </h3>
         <SidebarHeaderReloadButton onClick={() => mutate()} />
         <SidebarHeaderReloadButton onClick={() => mutate()} />
       </div>
       </div>

+ 2 - 1
packages/app/src/pages/[[...path]].page.tsx

@@ -292,7 +292,8 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
   useEffect(() => {
   useEffect(() => {
     const decodedURI = decodeURI(window.location.pathname);
     const decodedURI = decodeURI(window.location.pathname);
     if (isClient() && decodedURI !== props.currentPathname) {
     if (isClient() && decodedURI !== props.currentPathname) {
-      router.replace(props.currentPathname, undefined, { shallow: true });
+      const { search, hash } = window.location;
+      router.replace(`${props.currentPathname}${search}${hash}`, undefined, { shallow: true });
     }
     }
   }, [props.currentPathname, router]);
   }, [props.currentPathname, router]);