From ec08f47a66f7f586558f76f36d6759d9d1f73c61 Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 31 May 2024 08:33:34 +0200 Subject: [PATCH] Small type improvments --- src/collectionExporter.ts | 4 +++- src/exportManager.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/collectionExporter.ts b/src/collectionExporter.ts index c0df185..a91ee39 100644 --- a/src/collectionExporter.ts +++ b/src/collectionExporter.ts @@ -299,11 +299,13 @@ class CollectionExporter implements IExporter { /** * Loads the items and updates the database * - * @param loadedItems An array of items to load + * @param loadedItems An array of loaded items to sync with the database * @param merge boolean indicating whether to merge the items or replace them, ie. delete all items not in the JSON * @returns */ public async loadItems(loadedItems: Array, merge = false) { + if (merge && !loadedItems.length) return false; + const itemsSvc = await this._getService(); const { getKey, getPrimary, queryWithPrimary } = await this.settings(); diff --git a/src/exportManager.ts b/src/exportManager.ts index 95c2288..f63f09e 100644 --- a/src/exportManager.ts +++ b/src/exportManager.ts @@ -34,7 +34,7 @@ export class ExportManager { try { const finishUp = await this.exporters[i]!.exporter.load(merge); await this._loadNextExporter(i + 1, merge); - if (finishUp) await finishUp(); + if (typeof finishUp === 'function') await finishUp(); } catch (e) { this.logger.error(`Failed loading "${this.exporters[i]!.exporter.name}".`); throw e;