refactor(hooks): reduce null types (#3111)

(cherry picked from commit 8b5d997322)
This commit is contained in:
Alex Yang
2023-07-09 13:01:09 +08:00
parent fdffac6911
commit 0ddbe89d88
8 changed files with 31 additions and 58 deletions

View File

@@ -30,7 +30,7 @@ export const WorkspaceDeleteModal = ({
onDeleteWorkspace,
}: WorkspaceDeleteProps) => {
const [workspaceName] = useBlockSuiteWorkspaceName(
workspace.blockSuiteWorkspace ?? null
workspace.blockSuiteWorkspace
);
const [deleteStr, setDeleteStr] = useState<string>('');
const allowDelete = deleteStr === workspaceName;

View File

@@ -15,7 +15,7 @@ import {
} from './styles';
export type WorkspaceSelectorProps = {
currentWorkspace: AllWorkspace | null;
currentWorkspace: AllWorkspace;
onClick: () => void;
};
@@ -28,7 +28,7 @@ export const WorkspaceSelector: React.FC<WorkspaceSelectorProps> = ({
onClick,
}) => {
const [name] = useBlockSuiteWorkspaceName(
currentWorkspace?.blockSuiteWorkspace ?? null
currentWorkspace?.blockSuiteWorkspace
);
const [workspace] = useCurrentWorkspace();

View File

@@ -37,7 +37,7 @@ export type RootAppSidebarProps = {
onOpenQuickSearchModal: () => void;
onOpenSettingModal: () => void;
onOpenWorkspaceListModal: () => void;
currentWorkspace: AllWorkspace | null;
currentWorkspace: AllWorkspace;
openPage: (pageId: string) => void;
createPage: () => Page;
currentPath: string;