mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 03:56:23 +08:00
fix: deepscan error (#733)
This commit is contained in:
@@ -60,7 +60,7 @@ export const Editor = ({ page, workspace, setEditor }: Props) => {
|
||||
}
|
||||
|
||||
setEditor(editor);
|
||||
document.title = page?.meta.title || 'Untitled';
|
||||
document.title = page.meta.title || 'Untitled';
|
||||
return ret;
|
||||
}, [workspace, page, setEditor]);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ const Page: NextPageWithLayout = () => {
|
||||
p => p.id === router.query.pageId
|
||||
)
|
||||
) {
|
||||
const page = data.blocksuiteWorkspace?.getPage(
|
||||
const page = data.blocksuiteWorkspace.getPage(
|
||||
router.query.pageId as string
|
||||
);
|
||||
page && setPage(page);
|
||||
|
||||
@@ -101,14 +101,15 @@ export const AppStateProvider = ({
|
||||
}
|
||||
const workspace = (await dataCenter.loadWorkspace(workspaceId)) ?? null;
|
||||
let isOwner;
|
||||
if (workspace.provider === 'local') {
|
||||
if (workspace?.provider === 'local') {
|
||||
// isOwner is useful only in the cloud
|
||||
isOwner = true;
|
||||
} else {
|
||||
isOwner = workspace.owner && user?.id === workspace.owner.id;
|
||||
// We must ensure workspace.owner exists, then ensure id same.
|
||||
isOwner = workspace?.owner && user?.id === workspace.owner.id;
|
||||
}
|
||||
const pageList =
|
||||
(workspace.blocksuiteWorkspace?.meta.pageMetas as PageMeta[]) ?? [];
|
||||
(workspace?.blocksuiteWorkspace?.meta.pageMetas as PageMeta[]) ?? [];
|
||||
setAppState({
|
||||
...appState,
|
||||
currentWorkspace: workspace,
|
||||
|
||||
@@ -150,7 +150,9 @@ export class DataCenter {
|
||||
* @param {string} workspaceId workspace id
|
||||
* @returns {Promise<WorkspaceUnit>}
|
||||
*/
|
||||
public async loadWorkspace(workspaceId: string) {
|
||||
public async loadWorkspace(
|
||||
workspaceId: string
|
||||
): Promise<WorkspaceUnit | null> {
|
||||
const workspaceUnit = this._workspaceUnitCollection.find(workspaceId);
|
||||
assert(workspaceUnit, 'Workspace not found');
|
||||
const currentProvider = this.providerMap.get(workspaceUnit.provider);
|
||||
|
||||
Reference in New Issue
Block a user