mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 14:08:55 +08:00
feat: delete work space
This commit is contained in:
@@ -15,7 +15,6 @@ export type CreateEditorHandler = (page: StorePage) => EditorContainer | null;
|
||||
export interface AppStateValue {
|
||||
user: AccessTokenMessage | null;
|
||||
workspacesMeta: Workspace[];
|
||||
workspaces: Record<string, StoreWorkspace | null>;
|
||||
|
||||
currentWorkspaceId: string;
|
||||
currentWorkspace: StoreWorkspace | null;
|
||||
@@ -56,7 +55,7 @@ export const AppState = createContext<AppStateContext>({
|
||||
loadPage: () => Promise.resolve(null),
|
||||
createPage: () => Promise.resolve(null),
|
||||
synced: false,
|
||||
workspaces: {},
|
||||
// workspaces: {},
|
||||
});
|
||||
|
||||
export const useAppState = () => {
|
||||
|
||||
@@ -13,7 +13,7 @@ import type {
|
||||
LoadWorkspaceHandler,
|
||||
CreateEditorHandler,
|
||||
} from './context';
|
||||
import { downloadWorkspace, token } from '@pathfinder/data-services';
|
||||
import { token } from '@pathfinder/data-services';
|
||||
import { WebsocketProvider } from './y-websocket';
|
||||
|
||||
const getEditorParams = (workspaceId: string) => {
|
||||
@@ -90,19 +90,9 @@ const DynamicBlocksuite = ({
|
||||
);
|
||||
if (indexDBProvider) {
|
||||
(indexDBProvider as IndexedDBDocProvider).on('synced', async () => {
|
||||
// const updates = await downloadWorkspace({ workspaceId });
|
||||
// updates &&
|
||||
// Workspace.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');
|
||||
resolve(workspace);
|
||||
});
|
||||
} else {
|
||||
const updates = await downloadWorkspace({ workspaceId });
|
||||
updates &&
|
||||
Workspace.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');
|
||||
resolve(workspace);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -26,7 +26,6 @@ export const AppStateProvider = ({ children }: { children?: ReactNode }) => {
|
||||
currentWorkspace: null,
|
||||
currentPage: null,
|
||||
editor: null,
|
||||
workspaces: {},
|
||||
// Synced is used to ensure that the provider has synced with the server,
|
||||
// So after Synced set to true, the other state is sure to be set.
|
||||
synced: false,
|
||||
|
||||
Reference in New Issue
Block a user