From 990f693da811c4e1e1fd6b33fee6cfe6d8448395 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Tue, 3 Nov 2020 18:28:00 +0200 Subject: [PATCH] Update etebase dep and adjust according to the async changes. --- package.json | 2 +- src/Collections/CollectionChangeEntries.tsx | 2 +- src/Collections/CollectionEdit.tsx | 2 +- src/Collections/Main.tsx | 6 +++--- src/Debug.tsx | 2 +- src/Pim/ItemChangeHistory.tsx | 2 +- src/Pim/helpers.tsx | 14 +++++++------- src/etebase-helpers.ts | 2 +- src/sync/SyncManager.ts | 2 +- yarn.lock | 8 ++++---- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 2b4652b..4cc8ea0 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "@material-ui/lab": "^4.0.0-alpha.56", "@material-ui/pickers": "^3.2.10", "@material-ui/styles": "^4.10.0", - "etebase": "^0.20.0", + "etebase": "^0.30.0", "fuse.js": "^5.0.9-beta", "ical.js": "^1.4.0", "immutable": "^4.0.0-rc.12", diff --git a/src/Collections/CollectionChangeEntries.tsx b/src/Collections/CollectionChangeEntries.tsx index 5db149b..dc6f3ff 100644 --- a/src/Collections/CollectionChangeEntries.tsx +++ b/src/Collections/CollectionChangeEntries.tsx @@ -29,7 +29,7 @@ async function decryptItems(items: Map>) { for (const item of col.values()) { cur.set(item.uid, { item, - metadata: await item.getMeta(), + metadata: item.getMeta(), content: await item.getContent(Etebase.OutputFormat.String), }); } diff --git a/src/Collections/CollectionEdit.tsx b/src/Collections/CollectionEdit.tsx index 282da22..8983b1e 100644 --- a/src/Collections/CollectionEdit.tsx +++ b/src/Collections/CollectionEdit.tsx @@ -98,7 +98,7 @@ export default function CollectionEdit(props: PropsType) { let collection; if (props.collection) { collection = props.collection.collection; - await collection.setMeta(meta); + collection.setMeta(meta); } else { collection = await colMgr.create(colType, meta, ""); } diff --git a/src/Collections/Main.tsx b/src/Collections/Main.tsx index 14dbda2..1563f05 100644 --- a/src/Collections/Main.tsx +++ b/src/Collections/Main.tsx @@ -56,9 +56,9 @@ export default function CollectionsMain() { async function onDelete(collection: Etebase.Collection) { const colMgr = getCollectionManager(etebase); const mtime = (new Date()).getTime(); - const meta = await collection.getMeta(); - await collection.setMeta({ ...meta, mtime }); - await collection.delete(true); + const meta = collection.getMeta(); + collection.setMeta({ ...meta, mtime }); + collection.delete(true); await dispatch(collectionUpload(colMgr, collection)); dispatch(pushMessage({ message: "Collection deleted", severity: "success" })); diff --git a/src/Debug.tsx b/src/Debug.tsx index a9a21aa..6a3c0e8 100644 --- a/src/Debug.tsx +++ b/src/Debug.tsx @@ -71,7 +71,7 @@ export default function Debug() { console.log(wantAll, colItems.size); for (const cached of colItems.values()) { const item = itemMgr.cacheLoad(cached); - const meta = await item.getMeta(); + const meta = item.getMeta(); const content = await item.getContent(Etebase.OutputFormat.String); if (wantAll || wantedEntries[item.uid]) { retEntries.push(`${JSON.stringify(meta)}\n${content}`); diff --git a/src/Pim/ItemChangeHistory.tsx b/src/Pim/ItemChangeHistory.tsx index a317e4d..7b196b1 100644 --- a/src/Pim/ItemChangeHistory.tsx +++ b/src/Pim/ItemChangeHistory.tsx @@ -39,7 +39,7 @@ async function loadRevisions(etebase: Etebase.Account, col: Etebase.Collection, for (const item of revisions.data) { ret.push({ item, - metadata: await item.getMeta(), + metadata: item.getMeta(), content: await item.getContent(Etebase.OutputFormat.String), }); } diff --git a/src/Pim/helpers.tsx b/src/Pim/helpers.tsx index c8667b6..012573d 100644 --- a/src/Pim/helpers.tsx +++ b/src/Pim/helpers.tsx @@ -40,8 +40,8 @@ export function getDecryptCollectionsFunction(_colType?: string) { try { entries.push({ collection, - metadata: await collection.getMeta(), - collectionType: await collection.getCollectionType(), + metadata: collection.getMeta(), + collectionType: collection.getCollectionType(), }); } catch (e) { store.dispatch(appendError(e)); @@ -98,9 +98,9 @@ export async function itemSave(etebase: Etebase.Account, collection: Etebase.Col // Existing item eteItem = items!.get(collectionUid)?.get(itemUid)!; await eteItem.setContent(content); - const meta = await eteItem.getMeta(); + const meta = eteItem.getMeta(); meta.mtime = mtime; - await eteItem.setMeta(meta); + eteItem.setMeta(meta); } else { // New const meta: Etebase.ItemMetadata = { @@ -120,10 +120,10 @@ export async function itemDelete(etebase: Etebase.Account, collection: Etebase.C const eteItem = items!.get(collectionUid)?.get(itemUid)!; const mtime = (new Date()).getTime(); - const meta = await eteItem.getMeta(); + const meta = eteItem.getMeta(); meta.mtime = mtime; - await eteItem.setMeta(meta); - await eteItem.delete(true); + eteItem.setMeta(meta); + eteItem.delete(true); await asyncDispatch(itemBatch(collection, itemMgr, [eteItem])); } diff --git a/src/etebase-helpers.ts b/src/etebase-helpers.ts index 8079f73..1694d28 100644 --- a/src/etebase-helpers.ts +++ b/src/etebase-helpers.ts @@ -20,7 +20,7 @@ export const getCollectionsByType = memoize(async function (cachedCollections: C const collections = await getCollections(cachedCollections, etebase); const ret: Etebase.Collection[] = []; for (const col of collections) { - const collectionType = await col.getCollectionType(); + const collectionType = col.getCollectionType(); if (collectionType === colType) { ret.push(col); } diff --git a/src/sync/SyncManager.ts b/src/sync/SyncManager.ts index ec86e02..4f01520 100644 --- a/src/sync/SyncManager.ts +++ b/src/sync/SyncManager.ts @@ -66,7 +66,7 @@ export class SyncManager { while (!done) { const collections = await colMgr.list(this.COLLECTION_TYPES, { stoken, limit }); for (const col of collections.data) { - const collectionType = await col.getCollectionType(); + const collectionType = col.getCollectionType(); if (this.COLLECTION_TYPES.includes(collectionType)) { store.dispatch(setCacheCollection(colMgr, col)); await this.fetchCollection(col); diff --git a/yarn.lock b/yarn.lock index 4213650..164b3ae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4644,10 +4644,10 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= -etebase@^0.20.0: - version "0.20.0" - resolved "https://registry.yarnpkg.com/etebase/-/etebase-0.20.0.tgz#53537d76d71d356d2538c85292ee40ed32fde625" - integrity sha512-jmrrflrSG0kLe1ud3FjDishQ93Jx8s72r9xgkDxlVioxRJamJ0mE/+9KjfDRAFjWAzui8LIblOcIDw+NYPfbsA== +etebase@^0.30.0: + version "0.30.0" + resolved "https://registry.yarnpkg.com/etebase/-/etebase-0.30.0.tgz#60c33e0acaefcf02704ce31d0b831f0874de4f2a" + integrity sha512-MUQi04iQfDHaGhmx7b/JdouX2JZTEqnkqWUX+eedg1KHpa+se+kra/byQvrY7zzAbUueJiLnEdGfuFGCL/8ohw== dependencies: "@msgpack/msgpack" "^1.12.2" libsodium-wrappers "0.7.6"