There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix: infinite workspace loading (#1432)
Himself65101108824815
diff --git a/apps/web/src/providers/ModalProvider.tsx b/apps/web/src/providers/ModalProvider.tsxindex ca8ea7d6d3..879908bccf 100644--- a/apps/web/src/providers/ModalProvider.tsx+++ b/apps/web/src/providers/ModalProvider.tsx@@ -1,4 +1,4 @@-import { useAtom, useAtomValue, useSetAtom } from 'jotai';+import { useAtom, useAtomValue } from 'jotai';import dynamic from 'next/dynamic';import { useRouter } from 'next/router';import React, { useCallback } from 'react';@@ -9,6 +9,7 @@ import {openWorkspacesModalAtom,} from '../atoms';import { useCurrentUser } from '../hooks/current/use-current-user';+import { useCurrentWorkspace } from '../hooks/current/use-current-workspace';import { useRouterHelper } from '../hooks/use-router-helper';import { useWorkspaces, useWorkspacesHelper } from '../hooks/use-workspaces';import { WorkspaceSubPath } from '../shared';@@ -37,7 +38,7 @@ export function Modals() {const user = useCurrentUser();const workspaces = useWorkspaces();const currentWorkspaceId = useAtomValue(currentWorkspaceIdAtom);- const setCurrentWorkspace = useSetAtom(currentWorkspaceIdAtom);+ const [, setCurrentWorkspace] = useCurrentWorkspace();const { createLocalWorkspace } = useWorkspacesHelper();return (@@ -81,11 +82,13 @@ export function Modals() {const id = await createLocalWorkspace(name);setOpenCreateWorkspaceModal(false);setOpenWorkspacesModal(false);+ setCurrentWorkspace(id);return jumpToSubPath(id, WorkspaceSubPath.ALL);},[createLocalWorkspace,jumpToSubPath,+ setCurrentWorkspace,setOpenCreateWorkspaceModal,setOpenWorkspacesModal,]diff --git a/packages/component/src/ui/modal/Modal.tsx b/packages/component/src/ui/modal/Modal.tsxindex c96d4e446c..fe40d54971 100644--- a/packages/component/src/ui/modal/Modal.tsx+++ b/packages/component/src/ui/modal/Modal.tsx@@ -36,6 +36,12 @@ export const Modal = (props: ModalProps) => {...otherProps} = props;const [vertical, horizontal] = wrapperPosition;+ // Fixme: This is a workaround for Mui bug+ // Refs: https://github.com/mui/material-ui/issues/33748+ if (!open) {+ return null;+ }+return (<StyledModal{...otherProps}