@@ -143,6 +143,8 @@ export interface LineageProps extends StateProps, DispatchProps {}
143143let g : graphlib . Graph < MqNode >
144144
145145const Lineage : React . FC < LineageProps > = ( props : LineageProps ) => {
146+ console . log ( 'Lineage props' , props . depth )
147+
146148 React . useEffect ( ( ) => {
147149 console . log ( 'props.lineage' , props . lineage )
148150 } , [ props . lineage ] )
@@ -156,6 +158,7 @@ const Lineage: React.FC<LineageProps> = (props: LineageProps) => {
156158 const mounted = React . useRef < boolean > ( false )
157159
158160 const prevLineage = React . useRef < LineageGraph > ( )
161+ const prevDepth = React . useRef < number > ( )
159162 const prevSelectedNode = React . useRef < string > ( )
160163
161164 React . useEffect ( ( ) => {
@@ -168,6 +171,7 @@ const Lineage: React.FC<LineageProps> = (props: LineageProps) => {
168171 nodeName
169172 )
170173 props . setSelectedNode ( nodeId )
174+ console . log ( 'depth in init' , props . depth )
171175 props . fetchLineage (
172176 nodeType . toUpperCase ( ) as JobOrDataset ,
173177 namespace ,
@@ -179,7 +183,8 @@ const Lineage: React.FC<LineageProps> = (props: LineageProps) => {
179183 } else {
180184 // on update
181185 if (
182- JSON . stringify ( props . lineage ) !== JSON . stringify ( prevLineage . current ) &&
186+ ( JSON . stringify ( props . lineage ) !== JSON . stringify ( prevLineage . current ) ||
187+ props . depth !== prevDepth . current ) &&
183188 props . selectedNode
184189 ) {
185190 g = initGraph ( )
@@ -191,7 +196,11 @@ const Lineage: React.FC<LineageProps> = (props: LineageProps) => {
191196 } )
192197 } )
193198 }
194- if ( props . selectedNode !== prevSelectedNode . current ) {
199+ if (
200+ props . selectedNode !== prevSelectedNode . current
201+ || props . depth !== prevDepth . current
202+ ) {
203+ console . log ( 'depth in update' , props . depth )
195204 props . fetchLineage (
196205 nodeType ?. toUpperCase ( ) as JobOrDataset ,
197206 namespace || '' ,
@@ -202,6 +211,7 @@ const Lineage: React.FC<LineageProps> = (props: LineageProps) => {
202211 }
203212
204213 prevLineage . current = props . lineage
214+ prevDepth . current = props . depth
205215 prevSelectedNode . current = props . selectedNode
206216 }
207217 } )
0 commit comments