From bf1fbf2c5362fa3f69a0e9fb2f895ac45b5d1f80 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Thu, 9 Mar 2023 11:42:47 +0100 Subject: [PATCH] :adhesive_bandage: Fix crash on bot load when it has no groups --- apps/builder/src/features/graph/components/Graph.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/builder/src/features/graph/components/Graph.tsx b/apps/builder/src/features/graph/components/Graph.tsx index 5729679c0..df7a2dd9c 100644 --- a/apps/builder/src/features/graph/components/Graph.tsx +++ b/apps/builder/src/features/graph/components/Graph.tsx @@ -54,7 +54,9 @@ export const Graph = ({ } = useGraph() const { updateGroupCoordinates } = useGroupsCoordinates() const [graphPosition, setGraphPosition] = useState( - graphPositionDefaultValue(typebot.groups[0]?.graphCoordinates) + graphPositionDefaultValue( + typebot.groups.at(0)?.graphCoordinates ?? { x: 0, y: 0 } + ) ) const [debouncedGraphPosition] = useDebounce(graphPosition, 200) const transform = useMemo(