From 423446b318e2bb2fe29a2c7fbaf2728cc8d0194f Mon Sep 17 00:00:00 2001 From: asizemore Date: Thu, 19 Dec 2024 09:17:21 -0500 Subject: [PATCH] replace mutating state with better check of filters --- .../core/components/visualizations/VisualizationsContainer.tsx | 3 ++- .../implementations/VolcanoPlotVisualization.tsx | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/libs/eda/src/lib/core/components/visualizations/VisualizationsContainer.tsx b/packages/libs/eda/src/lib/core/components/visualizations/VisualizationsContainer.tsx index 6f84814aeb..2c7d29bd92 100644 --- a/packages/libs/eda/src/lib/core/components/visualizations/VisualizationsContainer.tsx +++ b/packages/libs/eda/src/lib/core/components/visualizations/VisualizationsContainer.tsx @@ -833,7 +833,8 @@ function ConfiguredVisualizationGrayOut({ } // using lodash isEqual to compare two objects - if (!isEqual(filters, currentPlotFilters)) { + // Sometimes filters or currentPlotFilters are undefined. In that case, assume there are no filters applied. + if (!isEqual(filters ?? [], currentPlotFilters ?? [])) { return ( <> Open to sync with diff --git a/packages/libs/eda/src/lib/core/components/visualizations/implementations/VolcanoPlotVisualization.tsx b/packages/libs/eda/src/lib/core/components/visualizations/implementations/VolcanoPlotVisualization.tsx index 540cdcee89..bf86519ff0 100755 --- a/packages/libs/eda/src/lib/core/components/visualizations/implementations/VolcanoPlotVisualization.tsx +++ b/packages/libs/eda/src/lib/core/components/visualizations/implementations/VolcanoPlotVisualization.tsx @@ -136,9 +136,6 @@ function VolcanoPlotViz(props: VisualizationProps) { plotContainerStyleOverrides, } = props; - // If no filters applied, the currentPlotFilters will be undefined. It should be an empty array. - visualization.descriptor.currentPlotFilters = - visualization.descriptor.currentPlotFilters ?? []; const studyMetadata = useStudyMetadata(); const { id: studyId } = studyMetadata; const entities = useStudyEntities(filters);