yuken 3 лет назад
Родитель
Сommit
262f4ee23f
1 измененных файлов с 2 добавлено и 42 удалено
  1. 2 42
      packages/app/src/pages/me.page.tsx

+ 2 - 42
packages/app/src/pages/me.page.tsx

@@ -1,7 +1,7 @@
 import React from 'react';
 import React from 'react';
 
 
 import {
 import {
-  IDataWithMeta, IPageInfoForEntity, IPagePopulatedToShowRevision, isIPageInfoForEntity, IUser, IUserHasId,
+  IUser, IUserHasId,
 } from '@growi/core';
 } from '@growi/core';
 import { model as mongooseModel } from 'mongoose';
 import { model as mongooseModel } from 'mongoose';
 import {
 import {
@@ -10,12 +10,10 @@ import {
 import { useTranslation } from 'next-i18next';
 import { useTranslation } from 'next-i18next';
 import dynamic from 'next/dynamic';
 import dynamic from 'next/dynamic';
 import { useRouter } from 'next/router';
 import { useRouter } from 'next/router';
-import superjson from 'superjson';
 
 
 import { CrowiRequest } from '~/interfaces/crowi-request';
 import { CrowiRequest } from '~/interfaces/crowi-request';
 import { ISidebarConfig } from '~/interfaces/sidebar-config';
 import { ISidebarConfig } from '~/interfaces/sidebar-config';
 import { IUserUISettings } from '~/interfaces/user-ui-settings';
 import { IUserUISettings } from '~/interfaces/user-ui-settings';
-import { PageDocument } from '~/server/models/page';
 import { UserUISettingsModel } from '~/server/models/user-ui-settings';
 import { UserUISettingsModel } from '~/server/models/user-ui-settings';
 import {
 import {
   usePreferDrawerModeByUser, usePreferDrawerModeOnEditByUser, useSidebarCollapsed, useCurrentSidebarContents, useCurrentProductNavWidth,
   usePreferDrawerModeByUser, usePreferDrawerModeOnEditByUser, useSidebarCollapsed, useCurrentSidebarContents, useCurrentProductNavWidth,
@@ -27,7 +25,7 @@ import { BasicLayout } from '../components/Layout/BasicLayout';
 import {
 import {
   useCurrentUser,
   useCurrentUser,
   useIsSearchServiceConfigured, useIsSearchServiceReachable,
   useIsSearchServiceConfigured, useIsSearchServiceReachable,
-  useCsrfToken, useIsSearchScopeChildrenAsDefault, useCurrentPathname,
+  useCsrfToken, useIsSearchScopeChildrenAsDefault,
   useRegistrationWhiteList,
   useRegistrationWhiteList,
 } from '../stores/context';
 } from '../stores/context';
 
 
@@ -38,35 +36,6 @@ import {
 
 
 const logger = loggerFactory('growi:pages:me');
 const logger = loggerFactory('growi:pages:me');
 
 
-
-type IPageToShowRevisionWithMeta = IDataWithMeta<IPagePopulatedToShowRevision & PageDocument, IPageInfoForEntity>;
-type IPageToShowRevisionWithMetaSerialized = IDataWithMeta<string, string>;
-
-superjson.registerCustom<IPageToShowRevisionWithMeta, IPageToShowRevisionWithMetaSerialized>(
-  {
-    isApplicable: (v): v is IPageToShowRevisionWithMeta => {
-      return v?.data != null
-        && v?.data.toObject != null
-        && v?.meta != null
-        && isIPageInfoForEntity(v.meta);
-    },
-    serialize: (v) => {
-      return {
-        data: superjson.stringify(v.data.toObject()),
-        meta: superjson.stringify(v.meta),
-      };
-    },
-    deserialize: (v) => {
-      return {
-        data: superjson.parse(v.data),
-        meta: v.meta != null ? superjson.parse(v.meta) : undefined,
-      };
-    },
-  },
-  'IPageToShowRevisionWithMetaTransformer',
-);
-
-
 type Props = CommonProps & {
 type Props = CommonProps & {
   currentUser: IUser,
   currentUser: IUser,
   isSearchServiceConfigured: boolean,
   isSearchServiceConfigured: boolean,
@@ -99,17 +68,8 @@ const MePage: NextPage<Props> = (props: Props) => {
   useIsSearchServiceConfigured(props.isSearchServiceConfigured);
   useIsSearchServiceConfigured(props.isSearchServiceConfigured);
   useIsSearchServiceReachable(props.isSearchServiceReachable);
   useIsSearchServiceReachable(props.isSearchServiceReachable);
   useIsSearchScopeChildrenAsDefault(props.isSearchScopeChildrenAsDefault);
   useIsSearchScopeChildrenAsDefault(props.isSearchScopeChildrenAsDefault);
-  useCurrentPathname(props.currentPathname);
   const { t } = useTranslation();
   const { t } = useTranslation();
 
 
-  // sync pathname by Shallow Routing https://nextjs.org/docs/routing/shallow-routing
-  // useEffect(() => {
-  //   const decodedURI = decodeURI(window.location.pathname);
-  //   if (isClient() && decodedURI !== props.currentPathname) {
-  //     router.replace(props.currentPathname, undefined, { shallow: true });
-  //   }
-  // }, [props.currentPathname, router]);
-
   const PersonalSettings = dynamic(() => import('~/components/Me/PersonalSettings'), { ssr: false });
   const PersonalSettings = dynamic(() => import('~/components/Me/PersonalSettings'), { ssr: false });
 
 
   return (
   return (