From 6281122394315bc24f609df5bb32c234b437960e Mon Sep 17 00:00:00 2001 From: Himself65 Date: Wed, 8 Mar 2023 01:08:24 -0600 Subject: [PATCH] refactor: remove `react-helmet-async` (#1409) --- apps/web/package.json | 1 - .../web/src/components/page-detail-editor.tsx | 6 +- apps/web/src/layouts/index.tsx | 6 +- apps/web/src/pages/404.tsx | 8 +- apps/web/src/pages/_app.tsx | 79 +++++++++---------- .../workspace/[workspaceId]/favorite.tsx | 6 +- .../pages/workspace/[workspaceId]/setting.tsx | 4 +- .../pages/workspace/[workspaceId]/trash.tsx | 6 +- pnpm-lock.yaml | 25 ------ 9 files changed, 55 insertions(+), 86 deletions(-) diff --git a/apps/web/package.json b/apps/web/package.json index 7d97c23ed9..11863c5001 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -33,7 +33,6 @@ "next-themes": "^0.2.1", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-helmet-async": "^1.3.0", "react-is": "^18.2.0", "swr": "^2.0.4", "y-indexeddb": "^9.0.9", diff --git a/apps/web/src/components/page-detail-editor.tsx b/apps/web/src/components/page-detail-editor.tsx index a90ecefb1e..94d9628802 100644 --- a/apps/web/src/components/page-detail-editor.tsx +++ b/apps/web/src/components/page-detail-editor.tsx @@ -1,8 +1,8 @@ import type { EditorContainer } from '@blocksuite/editor'; import { assertExists, Page } from '@blocksuite/store'; import dynamic from 'next/dynamic'; +import Head from 'next/head'; import React from 'react'; -import { Helmet } from 'react-helmet-async'; import { useBlockSuiteWorkspacePageTitle } from '../hooks/use-blocksuite-workspace-page-title'; import { usePageMeta } from '../hooks/use-page-meta'; @@ -48,9 +48,9 @@ export const PageDetailEditor: React.FC = ({ assertExists(meta); return ( <> - + {title} - + = ({ return ( <> - + {title} - + { export default function Custom404() { return ( <> - - s404 - AFFiNE - + + 404 - AFFiNE + ); diff --git a/apps/web/src/pages/_app.tsx b/apps/web/src/pages/_app.tsx index 66b2775180..9f405e7c4b 100644 --- a/apps/web/src/pages/_app.tsx +++ b/apps/web/src/pages/_app.tsx @@ -10,7 +10,6 @@ import { AppProps } from 'next/app'; import Head from 'next/head'; import { useRouter } from 'next/router'; import React, { memo, ReactElement, Suspense, useEffect, useMemo } from 'react'; -import { Helmet, HelmetProvider } from 'react-helmet-async'; import { jotaiStore } from '../atoms'; import { AffineErrorBoundary } from '../components/affine/affine-error-eoundary'; @@ -71,47 +70,43 @@ const App = function App({ [] )} > - - - AFFiNE - - - - - - - - - - - - - - - - {getLayout()} - + + AFFiNE + + + + + + + + + + + + + + {getLayout()} diff --git a/apps/web/src/pages/workspace/[workspaceId]/favorite.tsx b/apps/web/src/pages/workspace/[workspaceId]/favorite.tsx index c401c138b6..1bd3e4bddd 100644 --- a/apps/web/src/pages/workspace/[workspaceId]/favorite.tsx +++ b/apps/web/src/pages/workspace/[workspaceId]/favorite.tsx @@ -1,9 +1,9 @@ import { useTranslation } from '@affine/i18n'; import { FavoriteIcon } from '@blocksuite/icons'; import { assertExists } from '@blocksuite/store'; +import Head from 'next/head'; import { useRouter } from 'next/router'; import React, { useCallback } from 'react'; -import { Helmet } from 'react-helmet-async'; import PageList from '../../../components/blocksuite/block-suite-page-list/page-list'; import { PageLoading } from '../../../components/pure/loading'; @@ -42,9 +42,9 @@ const FavouritePage: NextPageWithLayout = () => { assertExists(blockSuiteWorkspace); return ( <> - + {t('Favorites')} - AFFiNE - + }>{t('Favorites')} { return ( <> - {t('Workspace Settings')} - AFFiNE + {t('Settings')} - AFFiNE }> {t('Workspace Settings')} @@ -150,7 +150,7 @@ const SettingPage: NextPageWithLayout = () => { return ( <> - {t('Workspace Settings')} - AFFiNE + {t('Settings')} - AFFiNE }> {t('Workspace Settings')} diff --git a/apps/web/src/pages/workspace/[workspaceId]/trash.tsx b/apps/web/src/pages/workspace/[workspaceId]/trash.tsx index 658be4afff..d02f950737 100644 --- a/apps/web/src/pages/workspace/[workspaceId]/trash.tsx +++ b/apps/web/src/pages/workspace/[workspaceId]/trash.tsx @@ -1,9 +1,9 @@ import { useTranslation } from '@affine/i18n'; import { DeleteTemporarilyIcon } from '@blocksuite/icons'; import { assertExists } from '@blocksuite/store'; +import Head from 'next/head'; import { useRouter } from 'next/router'; import React, { useCallback } from 'react'; -import { Helmet } from 'react-helmet-async'; import PageList from '../../../components/blocksuite/block-suite-page-list/page-list'; import { PageLoading } from '../../../components/pure/loading'; @@ -45,9 +45,9 @@ const TrashPage: NextPageWithLayout = () => { assertExists(blockSuiteWorkspace); return ( <> - + {t('Trash')} - AFFiNE - + }> {t('Trash')} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e436bd6269..672345f0d7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -179,7 +179,6 @@ importers: raw-loader: ^4.0.2 react: ^18.2.0 react-dom: ^18.2.0 - react-helmet-async: ^1.3.0 react-is: ^18.2.0 redux: ^4.2.1 swr: ^2.0.4 @@ -214,7 +213,6 @@ importers: next-themes: 0.2.1_nvzgbose6yf6w7ijjprgspqefi react: 18.2.0 react-dom: 18.2.0_react@18.2.0 - react-helmet-async: 1.3.0_biqbaboplfbrettd7655fr4n2y react-is: 18.2.0 swr: 2.0.4_react@18.2.0 y-indexeddb: 9.0.9_yjs@13.5.48 @@ -10998,25 +10996,6 @@ packages: react-is: 18.2.0 dev: true - /react-fast-compare/3.2.0: - resolution: {integrity: sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==} - dev: false - - /react-helmet-async/1.3.0_biqbaboplfbrettd7655fr4n2y: - resolution: {integrity: sha512-9jZ57/dAn9t3q6hneQS0wukqC2ENOBgMNVEhb/ZG9ZSxUetzVIw4iAmEU38IaVg3QGYauQPhSeUTuIUtFglWpg==} - peerDependencies: - react: ^16.6.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.6.0 || ^17.0.0 || ^18.0.0 - dependencies: - '@babel/runtime': 7.21.0 - invariant: 2.2.4 - prop-types: 15.8.1 - react: 18.2.0 - react-dom: 18.2.0_react@18.2.0 - react-fast-compare: 3.2.0 - shallowequal: 1.1.0 - dev: false - /react-i18next/12.2.0_3yopsigl4h4eb2nqrqfsy65uwi: resolution: {integrity: sha512-5XeVgSygaGfyFmDd2WcXvINRw2WEC1XviW1LXY/xLOEMzsCFRwKqfnHN+hUjla8ZipbVJR27GCMSuTr0BhBBBQ==} peerDependencies: @@ -11546,10 +11525,6 @@ packages: kind-of: 6.0.3 dev: true - /shallowequal/1.1.0: - resolution: {integrity: sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==} - dev: false - /shebang-command/2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'}