mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 05:14:54 +00:00
refactor: remove next/dynamic (#1901)
This commit is contained in:
@@ -3,10 +3,9 @@ import type { Page } from '@blocksuite/store';
|
||||
import { assertExists } from '@blocksuite/store';
|
||||
import { useBlockSuiteWorkspacePageTitle } from '@toeverything/hooks/use-blocksuite-workspace-page-title';
|
||||
import { useAtomValue, useSetAtom } from 'jotai';
|
||||
import dynamic from 'next/dynamic';
|
||||
import Head from 'next/head';
|
||||
import type React from 'react';
|
||||
import { useCallback } from 'react';
|
||||
import { lazy, useCallback } from 'react';
|
||||
|
||||
import { currentEditorAtom, workspacePreferredModeAtom } from '../atoms';
|
||||
import { usePageMeta } from '../hooks/use-page-meta';
|
||||
@@ -24,12 +23,10 @@ export type PageDetailEditorProps = {
|
||||
header?: React.ReactNode;
|
||||
};
|
||||
|
||||
const Editor = dynamic(
|
||||
async () =>
|
||||
(await import('./blocksuite/block-suite-editor')).BlockSuiteEditor,
|
||||
{
|
||||
ssr: false,
|
||||
}
|
||||
const Editor = lazy(() =>
|
||||
import('./blocksuite/block-suite-editor').then(module => ({
|
||||
default: module.BlockSuiteEditor,
|
||||
}))
|
||||
);
|
||||
|
||||
export const PageDetailEditor: React.FC<PageDetailEditorProps> = ({
|
||||
|
||||
@@ -2,8 +2,7 @@ import { MuiFade, Tooltip } from '@affine/component';
|
||||
import { config } from '@affine/env';
|
||||
import { useTranslation } from '@affine/i18n';
|
||||
import { CloseIcon, NewIcon } from '@blocksuite/icons';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useState } from 'react';
|
||||
import { lazy, useState } from 'react';
|
||||
|
||||
import { ShortcutsModal } from '../shortcuts-modal';
|
||||
import { ContactIcon, HelpIcon, KeyboardIcon } from './Icons';
|
||||
@@ -13,14 +12,11 @@ import {
|
||||
StyledIsland,
|
||||
StyledTriggerWrapper,
|
||||
} from './style';
|
||||
const ContactModal = dynamic(
|
||||
() =>
|
||||
import('@affine/component/contact-modal').then(({ ContactModal }) => ({
|
||||
default: ContactModal,
|
||||
})),
|
||||
{
|
||||
ssr: true,
|
||||
}
|
||||
|
||||
const ContactModal = lazy(() =>
|
||||
import('@affine/component/contact-modal').then(({ ContactModal }) => ({
|
||||
default: ContactModal,
|
||||
}))
|
||||
);
|
||||
|
||||
export type IslandItemNames = 'whatNew' | 'contact' | 'shortcuts';
|
||||
|
||||
Reference in New Issue
Block a user