Skip to content

Commit

Permalink
fix: node highlight issue
Browse files Browse the repository at this point in the history
  • Loading branch information
80avin committed Jun 20, 2024
1 parent 9b13eee commit efa0362
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/components/TreeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,17 @@ export const TreeView = (props) => {
}, [settings]);
const resizeChart = useCallback(async () => {
const dict = {};
const prevNodeUpdate = chartRef.current?.getChartState().nodeUpdate;
const data = chartRef.current!.data();
chartRef
.current!.nodeUpdate(function (d) {
dict[d.id] = {
h: this.querySelector("foreignObject>div>div").scrollHeight,
.current!.container()
.querySelectorAll("g.node")
.forEach((el, i) => {
dict[data[i].id] = {
h: el.querySelector("foreignObject>div>div").scrollHeight,
};
})
.render();
});

await delay(10);
chartRef.current!.nodeHeight((d) => dict[d.id]?.h || 150).render;
chartRef.current!.nodeUpdate(prevNodeUpdate);
chartRef.current!.nodeHeight((d) => dict[d.id]?.h || 150).render();
}, []);
useLayoutEffect(() => {
if (!flatData || !containerRef.current) return;
Expand Down

0 comments on commit efa0362

Please sign in to comment.