Skip to content

Commit 1adf0de

Browse files
authored
fix(compass-crud): no 0 default for bulkDelete count COMPASS-8603 (#6840)
* fix(compass-crud): do not use 0 as default for bulkDelete count COMPASS-8603 * test: update tests
1 parent 6968942 commit 1adf0de

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/compass-crud/src/stores/crud-store.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ describe('store', function () {
285285
debouncingLoad: false,
286286
loadingCount: false,
287287
collection: 'test',
288-
count: 0,
288+
count: null,
289289
docs: [],
290290
docsPerPage: 25,
291291
end: 0,
@@ -1170,6 +1170,7 @@ describe('store', function () {
11701170
store.state.insert.jsonView = true;
11711171
store.state.insert.doc = hadronDoc;
11721172
store.state.insert.jsonDoc = jsonDoc;
1173+
store.state.count = 0;
11731174
});
11741175

11751176
it('does not insert the document and sets the error', async function () {
@@ -1202,6 +1203,7 @@ describe('store', function () {
12021203
store.state.insert.jsonView = true;
12031204
store.state.insert.doc = hadronDoc;
12041205
store.state.insert.jsonDoc = jsonDoc;
1206+
store.state.count = 0;
12051207
});
12061208

12071209
afterEach(function () {
@@ -1233,6 +1235,7 @@ describe('store', function () {
12331235
beforeEach(function () {
12341236
store.state.insert.doc = doc;
12351237
store.state.insert.jsonDoc = jsonDoc;
1238+
store.state.count = 0;
12361239
});
12371240

12381241
afterEach(function () {
@@ -1267,6 +1270,7 @@ describe('store', function () {
12671270
store.state.insert.jsonView = true;
12681271
store.state.insert.doc = hadronDoc;
12691272
store.state.insert.jsonDoc = jsonDoc;
1273+
store.state.count = 0;
12701274
});
12711275

12721276
afterEach(async function () {
@@ -1425,6 +1429,7 @@ describe('store', function () {
14251429

14261430
beforeEach(function () {
14271431
store.state.insert.jsonDoc = JSON.stringify(docs);
1432+
store.state.count = 0;
14281433
});
14291434

14301435
afterEach(function () {

packages/compass-crud/src/stores/crud-store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ class CrudStoreImpl
426426
end: 0,
427427
page: 0,
428428
view: LIST,
429-
count: 0,
429+
count: null,
430430
insert: this.getInitialInsertState(),
431431
bulkUpdate: this.getInitialBulkUpdateState(),
432432
bulkDelete: this.getInitialBulkDeleteState(),
@@ -1913,7 +1913,7 @@ class CrudStoreImpl
19131913

19141914
const confirmation = await showConfirmation({
19151915
title: 'Are you absolutely sure?',
1916-
buttonText: `Delete ${affected || 0} document${
1916+
buttonText: `Delete ${affected ? `${affected} ` : ''} document${
19171917
affected !== 1 ? 's' : ''
19181918
}`,
19191919
description: `This action can not be undone. This will permanently delete ${

0 commit comments

Comments
 (0)