Fixed issue that would prevent the m2o from working on foreign keys with no meta row (#6263)

* Fix m2o reading from optional value

Fixes #6207

* Use optional chaining
This commit is contained in:
Rijk van Zanten
2021-06-14 14:32:25 -04:00
committed by GitHub
parent 8d0206a149
commit 35a304fd0a

View File

@@ -71,7 +71,7 @@
:collection="relatedCollection.collection"
:primary-key="currentPrimaryKey"
:edits="edits"
:circular-field="relation.meta.one_field"
:circular-field="relation.meta?.one_field"
@input="stageEdits"
/>
@@ -325,7 +325,7 @@ export default defineComponent({
});
const relatedCollection = computed(() => {
return collectionsStore.getCollection(relation.value.related_collection)!;
return collectionsStore.getCollection(relation.value.related_collection!)!;
});
const { primaryKeyField: relatedPrimaryKeyField } = useCollection(relatedCollection.value.collection);