mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix(core): find lost data (#4035)
This commit is contained in:
@@ -98,10 +98,17 @@ export const CRUD: WorkspaceCRUD<WorkspaceFlavour.LOCAL> = {
|
||||
list: async () => {
|
||||
logger.debug('list');
|
||||
const storage = getStorage();
|
||||
const allWorkspaceIDs: string[] = storage.getItem(kStoreKey, []) as z.infer<
|
||||
let allWorkspaceIDs: string[] = storage.getItem(kStoreKey, []) as z.infer<
|
||||
typeof schema
|
||||
>;
|
||||
|
||||
// fixme: remove this once desktop data migration is done
|
||||
if (window.apis && environment.isDesktop) {
|
||||
const desktopIds = (await window.apis.workspace.list()).map(v => v[0]);
|
||||
allWorkspaceIDs = [...new Set([...allWorkspaceIDs, ...desktopIds])];
|
||||
storage.setItem(kStoreKey, allWorkspaceIDs);
|
||||
}
|
||||
|
||||
const workspaces = (
|
||||
await Promise.all(allWorkspaceIDs.map(id => CRUD.get(id)))
|
||||
).filter(item => item !== null) as LocalWorkspace[];
|
||||
|
||||
Reference in New Issue
Block a user