From 50bc34ac264b926637819802d3a955ce8ed1c721 Mon Sep 17 00:00:00 2001 From: Paula Stachova Date: Fri, 4 Apr 2025 16:56:00 +0200 Subject: [PATCH 1/2] fix(compass-crud): do not use 0 as default for bulkDelete count COMPASS-8603 --- packages/compass-crud/src/stores/crud-store.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/compass-crud/src/stores/crud-store.ts b/packages/compass-crud/src/stores/crud-store.ts index 41857262dec..006bbfae4c9 100644 --- a/packages/compass-crud/src/stores/crud-store.ts +++ b/packages/compass-crud/src/stores/crud-store.ts @@ -426,7 +426,7 @@ class CrudStoreImpl end: 0, page: 0, view: LIST, - count: 0, + count: null, insert: this.getInitialInsertState(), bulkUpdate: this.getInitialBulkUpdateState(), bulkDelete: this.getInitialBulkDeleteState(), @@ -1913,7 +1913,7 @@ class CrudStoreImpl const confirmation = await showConfirmation({ title: 'Are you absolutely sure?', - buttonText: `Delete ${affected || 0} document${ + buttonText: `Delete ${affected ? `${affected} ` : ''} document${ affected !== 1 ? 's' : '' }`, description: `This action can not be undone. This will permanently delete ${ From 3986b1134db28a17ebbea0b5e6e7bed593197dc2 Mon Sep 17 00:00:00 2001 From: Paula Stachova Date: Fri, 4 Apr 2025 17:13:51 +0200 Subject: [PATCH 2/2] test: update tests --- packages/compass-crud/src/stores/crud-store.spec.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/compass-crud/src/stores/crud-store.spec.ts b/packages/compass-crud/src/stores/crud-store.spec.ts index 2b1c47ac349..626340340ed 100644 --- a/packages/compass-crud/src/stores/crud-store.spec.ts +++ b/packages/compass-crud/src/stores/crud-store.spec.ts @@ -285,7 +285,7 @@ describe('store', function () { debouncingLoad: false, loadingCount: false, collection: 'test', - count: 0, + count: null, docs: [], docsPerPage: 25, end: 0, @@ -1170,6 +1170,7 @@ describe('store', function () { store.state.insert.jsonView = true; store.state.insert.doc = hadronDoc; store.state.insert.jsonDoc = jsonDoc; + store.state.count = 0; }); it('does not insert the document and sets the error', async function () { @@ -1202,6 +1203,7 @@ describe('store', function () { store.state.insert.jsonView = true; store.state.insert.doc = hadronDoc; store.state.insert.jsonDoc = jsonDoc; + store.state.count = 0; }); afterEach(function () { @@ -1233,6 +1235,7 @@ describe('store', function () { beforeEach(function () { store.state.insert.doc = doc; store.state.insert.jsonDoc = jsonDoc; + store.state.count = 0; }); afterEach(function () { @@ -1267,6 +1270,7 @@ describe('store', function () { store.state.insert.jsonView = true; store.state.insert.doc = hadronDoc; store.state.insert.jsonDoc = jsonDoc; + store.state.count = 0; }); afterEach(async function () { @@ -1425,6 +1429,7 @@ describe('store', function () { beforeEach(function () { store.state.insert.jsonDoc = JSON.stringify(docs); + store.state.count = 0; }); afterEach(function () {