From 9a0b4430a6844b95b50bafb859dc8c07ecbcb8e2 Mon Sep 17 00:00:00 2001 From: Damian Zehnder Date: Wed, 8 Jan 2025 11:13:39 +0100 Subject: [PATCH] fix: import top pages --- .../src/v2/models/site-top-page/site-top-page.collection.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/spacecat-shared-data-access/src/v2/models/site-top-page/site-top-page.collection.js b/packages/spacecat-shared-data-access/src/v2/models/site-top-page/site-top-page.collection.js index e4cc5baf..c9a61ecd 100644 --- a/packages/spacecat-shared-data-access/src/v2/models/site-top-page/site-top-page.collection.js +++ b/packages/spacecat-shared-data-access/src/v2/models/site-top-page/site-top-page.collection.js @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import { hasText } from '@adobe/spacecat-shared-utils'; +import { hasText, isNonEmptyArray } from '@adobe/spacecat-shared-utils'; import BaseCollection from '../base/base.collection.js'; @@ -37,7 +37,9 @@ class SiteTopPageCollection extends BaseCollection { const topPageIdsToRemove = topPagesToRemove.map((topPage) => topPage.getId()); - await this.removeByIds(topPageIdsToRemove); + if (isNonEmptyArray(topPageIdsToRemove)) { + await this.removeByIds(topPageIdsToRemove); + } } }