Merge branch 'feat/filesystem_and_search' of https://github.com/toeverything/AFFiNE into feat/filesystem_and_search

This commit is contained in:
DarkSky
2022-12-23 13:37:09 +08:00
3 changed files with 11 additions and 8 deletions
@@ -13,7 +13,7 @@ import { Workspace, WorkspaceType } from '@pathfinder/data-services';
import { useAppState } from '@/providers/app-state-provider';
import { WorkspaceDetails } from '@/components/workspace-slider-bar/WorkspaceSelector/SelectorPopperContent';
import { WorkspaceDelete } from './delete';
import { Workspace as StoreWorkspaces } from '@blocksuite/store';
import { Workspace as StoreWorkspace } from '@blocksuite/store';
import { debounce } from '@/utils';
export const GeneralPage = ({
@@ -22,7 +22,7 @@ export const GeneralPage = ({
}: {
workspace: Workspace;
owner: WorkspaceDetails[string]['owner'];
workspaces: Record<string, StoreWorkspaces | null>;
workspaces: Record<string, StoreWorkspace | null>;
}) => {
const {
user,
@@ -3,7 +3,7 @@ import type { Page } from '@blocksuite/store';
import {
// createWebsocketDocProvider,
IndexedDBDocProvider,
Workspace,
Workspace as StoreWorkspace,
} from '@blocksuite/store';
import '@blocksuite/blocks';
import '@blocksuite/blocks/style';
@@ -31,7 +31,7 @@ const DynamicBlocksuite = ({
) =>
// eslint-disable-next-line no-async-promise-executor
new Promise(async resolve => {
const workspace = new Workspace({
const workspace = new StoreWorkspace({
room: workspaceId,
providers: [],
}).register(BlockSchema);
@@ -66,7 +66,7 @@ const DynamicBlocksuite = ({
);
const updates = await downloadWorkspace({ workspaceId });
updates &&
Workspace.Y.applyUpdate(workspace.doc, new Uint8Array(updates));
StoreWorkspace.Y.applyUpdate(workspace.doc, new Uint8Array(updates));
// if after update, the space:meta is empty, then we need to get map with doc
workspace.doc.getMap('space:meta');
if (indexDBProvider) {
@@ -13,7 +13,7 @@ import type {
CreateEditorHandler,
LoadWorkspaceHandler,
} from './context';
import { Page, Workspace } from '@blocksuite/store';
import { Page, Workspace as StoreWorkspace } from '@blocksuite/store';
import { EditorContainer } from '@blocksuite/editor';
const DynamicBlocksuite = dynamic(() => import('./dynamic-blocksuite'), {
ssr: false,
@@ -49,7 +49,10 @@ export const AppStateProvider = ({ children }: { children?: ReactNode }) => {
if (workspace) {
const updates = await downloadWorkspace({ workspaceId });
updates &&
Workspace.Y.applyUpdate(workspace.doc, new Uint8Array(updates));
StoreWorkspace.Y.applyUpdate(
workspace.doc,
new Uint8Array(updates)
);
// if after update, the space:meta is empty, then we need to get map with doc
workspace.doc.getMap('space:meta');
}
@@ -65,7 +68,7 @@ export const AppStateProvider = ({ children }: { children?: ReactNode }) => {
return { id, workspace };
})
);
const workspaces: Record<string, Workspace | null> = {};
const workspaces: Record<string, StoreWorkspace | null> = {};
workspacesList.forEach(({ id, workspace }) => {
workspaces[id] = workspace;
});