From fdfc8a46abbf7a52dbc6f60f8db44dfafc85aa06 Mon Sep 17 00:00:00 2001 From: Schlangstedt Anne Date: Fri, 12 Aug 2022 10:31:56 +0200 Subject: [PATCH] fixed drill down bug in layer panel --- public/components/pages/layer_panel/layer_panel.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/components/pages/layer_panel/layer_panel.tsx b/public/components/pages/layer_panel/layer_panel.tsx index 5ab26cd..369e053 100644 --- a/public/components/pages/layer_panel/layer_panel.tsx +++ b/public/components/pages/layer_panel/layer_panel.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import './layers.scss'; import { RootReducer } from '../../../reducer/root_reducer'; import { AnyAction, bindActionCreators, Dispatch } from 'redux'; @@ -17,6 +17,7 @@ interface LayerPanelProps { setLayerAction: Function; hideDrillDownGraph: Function; hideNodeDetailPanel: Function; + rootReducer: RootReducer; } const mapStateToProps = (state: LayerPanelState) => { @@ -26,6 +27,10 @@ const mapStateToProps = (state: LayerPanelState) => { export function LayerPanelComponent(props: LayerPanelProps) { const [currentLayer, setCurrentLayer] = useState(1); + useEffect(() => { + setCurrentLayer(props.rootReducer.layer.selectedLayer); + }, [props.rootReducer.layer.selectedLayer]); + const changeLayer = (layer: number) => { const { setLayerAction, hideDrillDownGraph, hideNodeDetailPanel } = props; setCurrentLayer(layer);