From 1ab004d6f7319b6443d46f9ca250916c4f8483c3 Mon Sep 17 00:00:00 2001 From: mahmoudadel54 Date: Wed, 13 Dec 2023 17:45:51 +0200 Subject: [PATCH] #9697: fix spatial filter and widget connection issues Description: - Resolve review comments --- web/client/epics/widgetsbuilder.js | 1 - web/client/reducers/__tests__/widgets-test.js | 2 +- web/client/reducers/widgets.js | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/web/client/epics/widgetsbuilder.js b/web/client/epics/widgetsbuilder.js index 02acef5679..3ca15f8bbc 100644 --- a/web/client/epics/widgetsbuilder.js +++ b/web/client/epics/widgetsbuilder.js @@ -70,7 +70,6 @@ export const initEditorOnNewChart = (action$, {getState = () => {}} = {}) => act charts: [ { chartId, - layer, legend: false, cartesian: true, traces: [ diff --git a/web/client/reducers/__tests__/widgets-test.js b/web/client/reducers/__tests__/widgets-test.js index c58101a69a..0162c6d0e3 100644 --- a/web/client/reducers/__tests__/widgets-test.js +++ b/web/client/reducers/__tests__/widgets-test.js @@ -176,7 +176,7 @@ describe('Test the widgets reducer', () => { expect(widgetObjects[1].layer).toEqual(newTargetLayer); expect(widgetObjects[2].layer).toEqual(state.containers[DEFAULT_TARGET].widgets[2].layer); expect(widgetObjects[3].layer).toEqual(newTargetLayer); - expect(widgetObjects[4].charts[0].layer).toEqual(newTargetLayer); + expect(widgetObjects[4].charts[0].layer.id).toEqual(newTargetLayer.id); expect(widgetObjects[4].charts[1].layer).toEqual(state.containers[DEFAULT_TARGET].widgets[4].charts[1].layer); expect(widgetObjects[4].charts[2].layer).toEqual(state.containers[DEFAULT_TARGET].widgets[4].charts[1].layer); expect(widgetObjects[4].charts[2].traces[0].layer).toEqual(state.containers[DEFAULT_TARGET].widgets[4].charts[2].traces[0].layer); diff --git a/web/client/reducers/widgets.js b/web/client/reducers/widgets.js index 94bbf67a8b..96f1fb0406 100644 --- a/web/client/reducers/widgets.js +++ b/web/client/reducers/widgets.js @@ -161,7 +161,6 @@ function widgetsReducer(state = emptyState, action) { let chartsCopy = w?.charts?.length ? [...w.charts] : []; chartsCopy = chartsCopy.map(chart=>{ let chartItem = {...chart}; - chartItem = get(chart, "layer.id") === action.layer.id ? set("layer", action.layer, chart) : chart; chartItem.traces = chartItem?.traces?.map(trace=> get(trace, "layer.id") === action.layer.id ? set("layer", action.layer, trace) : trace );