Skip to content

Commit 008a1ab

Browse files
committed
[minimap] fix #78
On the nodereducer, sometimes the `getNodeDisplayData` returns no value , even if the node is in the graph. Probably due to the fact that the node is currently rendering and so in the man time has no render values ... Adding default values to fix.
1 parent 8385cca commit 008a1ab

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎packages/minimap/src/Minimap.tsx‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@ export const MiniMap: FC<MiniMapProps> = ({ width, height, debounceTime }) => {
4747
*/
4848
const nodeReducer = useCallback(
4949
(node: string) => {
50-
const data = sigma.getNodeDisplayData(node)!;
50+
const data = sigma.getNodeDisplayData(node);
5151
return {
52-
...data,
52+
x: 0,
53+
y: 0,
54+
...(data || {}),
5355
type: 'circle',
54-
size: data.size * ratioHeight,
56+
size: (data?.size || 1) * ratioHeight,
57+
label: undefined,
5558
};
5659
},
5760
[sigma, ratioHeight],

0 commit comments

Comments
 (0)