fix: deepscan error (#733)
This commit is contained in:
@@ -60,7 +60,7 @@ export const Editor = ({ page, workspace, setEditor }: Props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setEditor(editor);
|
setEditor(editor);
|
||||||
document.title = page?.meta.title || 'Untitled';
|
document.title = page.meta.title || 'Untitled';
|
||||||
return ret;
|
return ret;
|
||||||
}, [workspace, page, setEditor]);
|
}, [workspace, page, setEditor]);
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const Page: NextPageWithLayout = () => {
|
|||||||
p => p.id === router.query.pageId
|
p => p.id === router.query.pageId
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
const page = data.blocksuiteWorkspace?.getPage(
|
const page = data.blocksuiteWorkspace.getPage(
|
||||||
router.query.pageId as string
|
router.query.pageId as string
|
||||||
);
|
);
|
||||||
page && setPage(page);
|
page && setPage(page);
|
||||||
|
|||||||
@@ -101,14 +101,15 @@ export const AppStateProvider = ({
|
|||||||
}
|
}
|
||||||
const workspace = (await dataCenter.loadWorkspace(workspaceId)) ?? null;
|
const workspace = (await dataCenter.loadWorkspace(workspaceId)) ?? null;
|
||||||
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 {
|
||||||
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 =
|
const pageList =
|
||||||
(workspace.blocksuiteWorkspace?.meta.pageMetas as PageMeta[]) ?? [];
|
(workspace?.blocksuiteWorkspace?.meta.pageMetas as PageMeta[]) ?? [];
|
||||||
setAppState({
|
setAppState({
|
||||||
...appState,
|
...appState,
|
||||||
currentWorkspace: workspace,
|
currentWorkspace: workspace,
|
||||||
|
|||||||
@@ -150,7 +150,9 @@ export class DataCenter {
|
|||||||
* @param {string} workspaceId workspace id
|
* @param {string} workspaceId workspace id
|
||||||
* @returns {Promise<WorkspaceUnit>}
|
* @returns {Promise<WorkspaceUnit>}
|
||||||
*/
|
*/
|
||||||
public async loadWorkspace(workspaceId: string) {
|
public async loadWorkspace(
|
||||||
|
workspaceId: string
|
||||||
|
): Promise<WorkspaceUnit | null> {
|
||||||
const workspaceUnit = this._workspaceUnitCollection.find(workspaceId);
|
const workspaceUnit = this._workspaceUnitCollection.find(workspaceId);
|
||||||
assert(workspaceUnit, 'Workspace not found');
|
assert(workspaceUnit, 'Workspace not found');
|
||||||
const currentProvider = this.providerMap.get(workspaceUnit.provider);
|
const currentProvider = this.providerMap.get(workspaceUnit.provider);
|
||||||
|
|||||||
Reference in New Issue
Block a user