@localstack/appinspector-ui 1.0.34 → 1.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4540,16 +4540,10 @@ var TraceGraph = ({
4540
4540
  spans,
4541
4541
  viewPortPixelWidth
4542
4542
  }) => {
4543
- const [nodes, setNodes] = (0, import_react18.useState)([]);
4543
+ const [nodes, setNodes, onNodesChange] = (0, import_react17.useNodesState)([]);
4544
4544
  const [edges, setEdges] = (0, import_react18.useState)([]);
4545
4545
  const [initialViewSet, setInitialViewSet] = (0, import_react18.useState)(false);
4546
4546
  const { fitView, setCenter } = (0, import_react17.useReactFlow)();
4547
- const updateSelectedNode = (0, import_react18.useCallback)((nodeId) => {
4548
- const toSelect = new Set(nodeId ? [nodeId] : []);
4549
- setNodes((previousNodes) => {
4550
- return previousNodes.map((node) => ({ ...node, selected: toSelect.has(node.id) }));
4551
- });
4552
- }, []);
4553
4547
  (0, import_react18.useEffect)(() => {
4554
4548
  const spansMap = /* @__PURE__ */ new Map();
4555
4549
  const rootSpans = [];
@@ -4584,7 +4578,7 @@ var TraceGraph = ({
4584
4578
  }
4585
4579
  setNodes(layoutedNodes);
4586
4580
  setEdges(layoutedEdges);
4587
- }, [spans.data, initialFocusEventId]);
4581
+ }, [spans.data, initialFocusEventId, setNodes]);
4588
4582
  (0, import_react18.useEffect)(() => {
4589
4583
  const shouldSetInitialView = !spans.loading && nodes.length > 0 && !initialViewSet;
4590
4584
  if (shouldSetInitialView) {
@@ -4605,15 +4599,6 @@ var TraceGraph = ({
4605
4599
  setInitialViewSet(true);
4606
4600
  }
4607
4601
  }, [spans.loading, nodes, initialFocusEventId, viewPortPixelWidth, setCenter, fitView, onEventSelect, initialViewSet]);
4608
- (0, import_react18.useEffect)(() => {
4609
- if (initialFocusEventId) {
4610
- updateSelectedNode(initialFocusEventId);
4611
- }
4612
- }, [initialFocusEventId, updateSelectedNode]);
4613
- const onNodeClick = (0, import_react18.useCallback)((_event, node) => {
4614
- onEventSelect(node.data.event);
4615
- updateSelectedNode(node.id);
4616
- }, [onEventSelect, updateSelectedNode]);
4617
4602
  const theme = (0, import_material19.useTheme)();
4618
4603
  return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_jsx_runtime140.Fragment, { children: [
4619
4604
  spans.error && /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
@@ -4641,7 +4626,10 @@ var TraceGraph = ({
4641
4626
  minZoom: 0.1,
4642
4627
  nodes,
4643
4628
  nodeTypes,
4644
- onNodeClick,
4629
+ onNodeClick: (_event, node) => {
4630
+ onEventSelect(node.data.event);
4631
+ },
4632
+ onNodesChange,
4645
4633
  selectNodesOnDrag: false,
4646
4634
  children: [
4647
4635
  /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(Controls, {}),