diff --git a/app/src/interfaces/files/files.vue b/app/src/interfaces/files/files.vue
index 5db7f7a33d..e4f2ca262e 100644
--- a/app/src/interfaces/files/files.vue
+++ b/app/src/interfaces/files/files.vue
@@ -45,7 +45,7 @@
:collection="relationFields.junctionCollection"
:primary-key="currentlyEditing || '+'"
:edits="editsAtStart"
- :related-primary-key="relationFields.relationPkField"
+ :related-primary-key="relationFields.relationPkField || '+'"
:junction-field="relationFields.junctionRelation"
@input="stageEdits"
@update:active="cancelEdit"
@@ -165,10 +165,8 @@ export default defineComponent({
const { cancelEdit, stageEdits, editsAtStart, editItem, currentlyEditing } = useEdit(
value,
- items,
relationFields,
- emitter,
- getJunctionFromRelatedId
+ emitter
);
const { stageSelection, selectModalActive, selectionFilters } = useSelection(
diff --git a/app/src/interfaces/many-to-many/many-to-many.vue b/app/src/interfaces/many-to-many/many-to-many.vue
index af3de9b0e6..21f23e5254 100644
--- a/app/src/interfaces/many-to-many/many-to-many.vue
+++ b/app/src/interfaces/many-to-many/many-to-many.vue
@@ -5,7 +5,7 @@
@@ -46,9 +46,9 @@
-
+
{{ $t('interfaces.one-to-many.no_collection') }}
@@ -20,7 +22,6 @@ import { defineComponent, PropType, computed } from '@vue/composition-api';
import { useRelationsStore } from '@/stores/';
import { Relation, Collection } from '@/types';
import { useCollectionsStore } from '../../stores';
-
export default defineComponent({
props: {
collection: {
@@ -51,7 +52,6 @@ export default defineComponent({
setup(props, { emit }) {
const collectionsStore = useCollectionsStore();
const relationsStore = useRelationsStore();
-
const fields = computed({
get() {
return props.value?.fields;
@@ -63,41 +63,26 @@ export default defineComponent({
});
},
});
-
- const relatedCollection = computed(() => {
+ const junctionCollection = computed(() => {
if (!props.fieldData || !props.relations || props.relations.length === 0) return null;
-
const { field } = props.fieldData;
-
const junctionRelation = props.relations.find(
(relation) => relation.one_collection === props.collection && relation.one_field === field
);
-
- if (junctionRelation === undefined) return;
-
- const relatedCollection = props.relations.find(
- (relation) =>
- relation.one_collection !== props.collection &&
- relation.many_field === junctionRelation.junction_field
- );
-
- return relatedCollection?.one_collection || null;
+ return junctionRelation?.many_collection || null;
});
-
- const relatedCollectionExists = computed(() => {
+ const junctionCollectionExists = computed(() => {
return !!collectionsStore.state.collections.find(
- (collection) => collection.collection === relatedCollection.value
+ (collection) => collection.collection === junctionCollection.value
);
});
-
- return { fields, relatedCollection, relatedCollectionExists };
+ return { fields, junctionCollection, junctionCollectionExists };
},
});