Skip to content

Commit d151718

Browse files
committed
ui: resolve node label/color/hover columns to ColInfo in GraphWidget
vis.proto added Graph.{node_label,node_color,node_hover}_column + NodeThresholds in commit 94f1c86; graph.tsx's GraphProps typed the new node-side fields as ColInfo to mirror the existing edge fields, but the GraphWidget caller only spread `{...display}` (raw strings from the vis spec) and resolved just the edge columns through colInfoFromName. That broke prod with: graph.tsx(353,10): error TS2322: Types of property 'nodeLabelColumn' are incompatible. Type 'string' is not assignable to type 'ColInfo'. Resolve nodeLabelColumn, nodeColorColumn, and the new nodeHoverInfo array through colInfoFromName the same way the edge equivalents are resolved, and pass them explicitly to <Graph> so they override the raw strings from the spread. Verified locally: bazel build --config=stamp --config=x86_64_sysroot //src/ui:ui_bundle now produces ui_bundle.tar.gz cleanly (6.1 MB). v0.0.11 cloud-release tag hit the same TS error in CI; v0.0.12 will be cut from this commit.
1 parent 47c14cc commit d151718

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • src/ui/src/containers/live-widgets/graph

src/ui/src/containers/live-widgets/graph/graph.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ export const GraphWidget = React.memo<GraphWidgetProps>(({
339339
}
340340
const colorColInfo = colInfoFromName(relation, display.edgeColorColumn);
341341
const labelColInfo = colInfoFromName(relation, display.edgeLabelColumn);
342+
const nodeLabelColInfo = colInfoFromName(relation, display.nodeLabelColumn);
343+
const nodeColorColInfo = colInfoFromName(relation, display.nodeColorColumn);
342344
const edgeHoverInfo = [];
343345
if (display.edgeHoverInfo && display.edgeHoverInfo.length > 0) {
344346
for (const e of display.edgeHoverInfo) {
@@ -348,6 +350,15 @@ export const GraphWidget = React.memo<GraphWidgetProps>(({
348350
}
349351
}
350352
}
353+
const nodeHoverInfo = [];
354+
if (display.nodeHoverInfo && display.nodeHoverInfo.length > 0) {
355+
for (const n of display.nodeHoverInfo) {
356+
const info = colInfoFromName(relation, n);
357+
if (info) {
358+
nodeHoverInfo.push(info);
359+
}
360+
}
361+
}
351362
if (toColInfo && fromColInfo && !errorMsg) {
352363
return (
353364
<Graph
@@ -357,8 +368,11 @@ export const GraphWidget = React.memo<GraphWidgetProps>(({
357368
fromCol={fromColInfo}
358369
edgeColorColumn={colorColInfo}
359370
edgeLabelColumn={labelColInfo}
371+
nodeLabelColumn={nodeLabelColInfo}
372+
nodeColorColumn={nodeColorColInfo}
360373
propagatedArgs={propagatedArgs}
361374
edgeHoverInfo={edgeHoverInfo}
375+
nodeHoverInfo={nodeHoverInfo}
362376
setExternalControls={setExternalControls}
363377
/>
364378
);

0 commit comments

Comments
 (0)