There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(core): collections data migration without blocking data reads (#4866)
3720da2821eaac90
diff --git a/packages/frontend/core/src/atoms/collections.ts b/packages/frontend/core/src/atoms/collections.tsindex af63fb76c9..6bf960229d 100644--- a/packages/frontend/core/src/atoms/collections.ts+++ b/packages/frontend/core/src/atoms/collections.ts@@ -101,7 +101,6 @@ export const pageCollectionBaseAtom =const migrateCollectionsFromIdbData = async (workspace: Workspace): Promise<Collection[]> => {- workspace.awarenessStore.awareness.emit('change log');const localCRUD = get(localCollectionCRUDAtom);const collections = await getCollections(localCRUD);const result = collections.filter(v => v.workspaceId === workspace.id);@@ -149,18 +148,17 @@ export const pageCollectionBaseAtom =return new Observable<BaseCollectionsDataType>(subscriber => {const group = new DisposableGroup();currentWorkspacePromise.then(async currentWorkspace => {- const collectionsFromLocal =- await migrateCollectionsFromIdbData(currentWorkspace);- const collectionFromUserSetting =- await migrateCollectionsFromUserData(currentWorkspace);const workspaceSetting = getWorkspaceSetting(currentWorkspace);- if (collectionsFromLocal.length || collectionFromUserSetting.length) {- // migrate collections- workspaceSetting.addCollection(- ...collectionFromUserSetting,- ...collectionsFromLocal- );- }+ migrateCollectionsFromIdbData(currentWorkspace).then(collections => {+ if (collections.length) {+ workspaceSetting.addCollection(...collections);+ }+ });+ migrateCollectionsFromUserData(currentWorkspace).then(collections => {+ if (collections.length) {+ workspaceSetting.addCollection(...collections);+ }+ });subscriber.next({loading: false,collections: workspaceSetting.collections,