From a84d44e05b7abb0a8f2c2ec0e1a1ea15c4349c6c Mon Sep 17 00:00:00 2001 From: Martin Ohlson Date: Tue, 12 Mar 2024 14:27:06 +0000 Subject: [PATCH] fix: prevent period SC to trigger on change when selected item is clicked --- cypress/helpers/period.js | 2 ++ src/components/Dialogs/PeriodDimension/PeriodDimension.js | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cypress/helpers/period.js b/cypress/helpers/period.js index 24c494a51..c99a69437 100644 --- a/cypress/helpers/period.js +++ b/cypress/helpers/period.js @@ -71,6 +71,8 @@ const selectRelativePeriod = ({ label, period }) => { const unselectAllPeriods = ({ label }) => { openPeriod(label) + cy.contains('Choose from presets').click() + cy.getBySel('period-dimension-transfer-actions-removeall').click() cy.getBySel('period-dimension-modal-action-confirm').click() } diff --git a/src/components/Dialogs/PeriodDimension/PeriodDimension.js b/src/components/Dialogs/PeriodDimension/PeriodDimension.js index b7d3f4199..59a112247 100644 --- a/src/components/Dialogs/PeriodDimension/PeriodDimension.js +++ b/src/components/Dialogs/PeriodDimension/PeriodDimension.js @@ -165,8 +165,10 @@ export const PeriodDimension = ({ dimension, onClose }) => { } const onSegmentedControlChange = ({ value }) => { - setEntryMethod(value) - updatePeriodDimensionItems([]) + if (value !== entryMethod) { + setEntryMethod(value) + updatePeriodDimensionItems([]) + } } return dimension ? (