From 91b933f64337c5e40873cab2a19fe55d11a82381 Mon Sep 17 00:00:00 2001 From: Le Roux Bodenstein Date: Tue, 25 Mar 2025 11:23:38 +0000 Subject: [PATCH] pipelines work one way, other query types another --- .../src/stores/delete-item.ts | 7 ++++--- .../src/stores/edit-item.ts | 7 ++++--- .../src/stores/open-item.ts | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/compass-saved-aggregations-queries/src/stores/delete-item.ts b/packages/compass-saved-aggregations-queries/src/stores/delete-item.ts index fcd507693c5..ba8e1b646de 100644 --- a/packages/compass-saved-aggregations-queries/src/stores/delete-item.ts +++ b/packages/compass-saved-aggregations-queries/src/stores/delete-item.ts @@ -55,10 +55,11 @@ export const confirmDeleteItem = ( undefined // this event is connection scoped when triggered from the aggregation or query screen ); - if (item.type === 'query') { - await queryStorage?.delete(item.id); - } else { + if (item.type === 'aggregation') { await pipelineStorage?.delete(item.id); + } else { + // query or updatemany + await queryStorage?.delete(item.id); } dispatch({ type: ActionTypes.DeleteItemConfirm, id: item.id }); diff --git a/packages/compass-saved-aggregations-queries/src/stores/edit-item.ts b/packages/compass-saved-aggregations-queries/src/stores/edit-item.ts index 76fa42d828a..a78c09fff6a 100644 --- a/packages/compass-saved-aggregations-queries/src/stores/edit-item.ts +++ b/packages/compass-saved-aggregations-queries/src/stores/edit-item.ts @@ -87,13 +87,14 @@ export const updateItem = return; } - if (item.type === 'query') { + if (item.type === 'aggregation') { + await pipelineStorage?.updateAttributes(id, attributes); + } else { + // query or updatemany await queryStorage?.updateAttributes(id, { _name: attributes.name, _dateModified: new Date(), }); - } else { - await pipelineStorage?.updateAttributes(id, attributes); } dispatch({ diff --git a/packages/compass-saved-aggregations-queries/src/stores/open-item.ts b/packages/compass-saved-aggregations-queries/src/stores/open-item.ts index 7cd6cbce17d..8a9589f4204 100644 --- a/packages/compass-saved-aggregations-queries/src/stores/open-item.ts +++ b/packages/compass-saved-aggregations-queries/src/stores/open-item.ts @@ -572,7 +572,8 @@ export const openSelectedItem = await pipelineStorage?.updateAttributes(id, { namespace: newNamespace, }); - } else if (selectedItem.type === 'query') { + } else { + // query or updatemany await queryStorage?.updateAttributes(id, { _ns: newNamespace }); } }