From a9ac11452dfeac20f95a18eb5b6cfd17fdacae4f Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 13 Feb 2026 19:32:29 +0200 Subject: [PATCH] fix(relation_map): crash when valid JSON, but missing data (closes #8702) --- .../src/widgets/type_widgets/relation_map/RelationMap.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/client/src/widgets/type_widgets/relation_map/RelationMap.tsx b/apps/client/src/widgets/type_widgets/relation_map/RelationMap.tsx index 96ede43f7c..867fd44d39 100644 --- a/apps/client/src/widgets/type_widgets/relation_map/RelationMap.tsx +++ b/apps/client/src/widgets/type_widgets/relation_map/RelationMap.tsx @@ -65,7 +65,7 @@ export default function RelationMap({ note, noteContext, ntxId, parentComponent }; }, onContentChange(content) { - let newData: MapData | null = null; + let newData: Partial | null = null; if (content) { try { @@ -75,7 +75,7 @@ export default function RelationMap({ note, noteContext, ntxId, parentComponent } } - if (!newData) { + if (!newData || !newData.notes || !newData.transform) { newData = { notes: [], // it is important to have this exact value here so that initial transform is the same as this @@ -90,8 +90,8 @@ export default function RelationMap({ note, noteContext, ntxId, parentComponent }; } - setData(newData); - mapApiRef.current = new RelationMapApi(note, newData, (newData, refreshUi) => { + setData(newData as MapData); + mapApiRef.current = new RelationMapApi(note, newData as MapData, (newData, refreshUi) => { if (refreshUi) { setData(newData); }