mirror of
https://github.com/zadam/trilium.git
synced 2026-02-19 12:14:23 +01:00
fix(relation_map): crash when valid JSON, but missing data (closes #8702)
This commit is contained in:
parent
04b91308b1
commit
a9ac11452d
@ -65,7 +65,7 @@ export default function RelationMap({ note, noteContext, ntxId, parentComponent
|
||||
};
|
||||
},
|
||||
onContentChange(content) {
|
||||
let newData: MapData | null = null;
|
||||
let newData: Partial<MapData> | 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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user