mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
fix: remove duplicated nullish coalescing (#1132)
This commit is contained in:
@@ -75,7 +75,11 @@ export const createDataCenterActions: GlobalActionsCreator<
|
|||||||
if (workspaceId === currentDataCenterWorkspace?.id) {
|
if (workspaceId === currentDataCenterWorkspace?.id) {
|
||||||
return currentDataCenterWorkspace;
|
return currentDataCenterWorkspace;
|
||||||
}
|
}
|
||||||
const workspace = (await dataCenter.loadWorkspace(workspaceId)) ?? null;
|
const workspace = await dataCenter.loadWorkspace(workspaceId);
|
||||||
|
|
||||||
|
if (!workspace) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (signal?.aborted) {
|
if (signal?.aborted) {
|
||||||
// do not update state if aborted
|
// do not update state if aborted
|
||||||
@@ -83,17 +87,17 @@ export const createDataCenterActions: GlobalActionsCreator<
|
|||||||
}
|
}
|
||||||
|
|
||||||
let isOwner;
|
let isOwner;
|
||||||
if (workspace?.provider === 'local') {
|
if (workspace.provider === 'local') {
|
||||||
// isOwner is useful only in the cloud
|
// isOwner is useful only in the cloud
|
||||||
isOwner = true;
|
isOwner = true;
|
||||||
} else {
|
} else {
|
||||||
const userInfo = get().user; // We must ensure workspace.owner exists, then ensure id same.
|
const userInfo = get().user; // We must ensure workspace.owner exists, then ensure id same.
|
||||||
isOwner = userInfo?.id === workspace?.owner?.id;
|
isOwner = userInfo?.id === workspace.owner?.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pageList =
|
const pageList =
|
||||||
(workspace?.blocksuiteWorkspace?.meta.pageMetas as PageMeta[]) ?? [];
|
(workspace.blocksuiteWorkspace?.meta.pageMetas as PageMeta[]) ?? [];
|
||||||
if (workspace?.blocksuiteWorkspace) {
|
if (workspace.blocksuiteWorkspace) {
|
||||||
set({
|
set({
|
||||||
currentWorkspace: workspace.blocksuiteWorkspace,
|
currentWorkspace: workspace.blocksuiteWorkspace,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user