mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
feat: lazy load modal components (#1337)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useAtom, useAtomValue, useSetAtom } from 'jotai';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { useRouter } from 'next/router';
|
||||
import React, { useCallback } from 'react';
|
||||
|
||||
@@ -7,12 +8,20 @@ import {
|
||||
openCreateWorkspaceModalAtom,
|
||||
openWorkspacesModalAtom,
|
||||
} from '../atoms';
|
||||
import { CreateWorkspaceModal } from '../components/pure/create-workspace-modal';
|
||||
import { WorkspaceListModal } from '../components/pure/workspace-list-modal';
|
||||
import { useCurrentUser } from '../hooks/current/use-current-user';
|
||||
import { useWorkspaces, useWorkspacesHelper } from '../hooks/use-workspaces';
|
||||
import { apis } from '../shared/apis';
|
||||
|
||||
const WorkspaceListModal = dynamic(
|
||||
async () =>
|
||||
(await import('../components/pure/workspace-list-modal')).WorkspaceListModal
|
||||
);
|
||||
const CreateWorkspaceModal = dynamic(
|
||||
async () =>
|
||||
(await import('../components/pure/create-workspace-modal'))
|
||||
.CreateWorkspaceModal
|
||||
);
|
||||
|
||||
export function Modals() {
|
||||
const [openWorkspacesModal, setOpenWorkspacesModal] = useAtom(
|
||||
openWorkspacesModalAtom
|
||||
|
||||
Reference in New Issue
Block a user