mirror of
https://github.com/directus/directus.git
synced 2026-01-29 08:17:55 -05:00
Fix related primary key lookup in list-m2m (#12840)
* Fix related primary key lookup in list-m2m Fixes #12836 * Apply the same fix for m2a
This commit is contained in:
@@ -266,6 +266,7 @@ function editItem(item: DisplayItem) {
|
||||
|
||||
const relationPkField =
|
||||
relationInfo.value.relationPrimaryKeyFields[item[relationInfo.value.collectionField.field]].field;
|
||||
const junctionField = relationInfo.value.junctionField.field;
|
||||
const junctionPkField = relationInfo.value.junctionPrimaryKeyField.field;
|
||||
|
||||
newItem = false;
|
||||
@@ -279,7 +280,7 @@ function editItem(item: DisplayItem) {
|
||||
} else {
|
||||
if (!relationPkField) return;
|
||||
currentlyEditing.value = get(item, [junctionPkField], null);
|
||||
relatedPrimaryKey.value = get(item, [junctionPkField, relationPkField], null);
|
||||
relatedPrimaryKey.value = get(item, [junctionField, relationPkField], null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -224,6 +224,7 @@ function editItem(item: DisplayItem) {
|
||||
if (!relationInfo.value) return;
|
||||
|
||||
const relationPkField = relationInfo.value.relatedPrimaryKeyField.field;
|
||||
const junctionField = relationInfo.value.junctionField.field;
|
||||
const junctionPkField = relationInfo.value.junctionPrimaryKeyField.field;
|
||||
|
||||
newItem = false;
|
||||
@@ -236,7 +237,7 @@ function editItem(item: DisplayItem) {
|
||||
relatedPrimaryKey.value = null;
|
||||
} else {
|
||||
currentlyEditing.value = get(item, [junctionPkField], null);
|
||||
relatedPrimaryKey.value = get(item, [junctionPkField, relationPkField], null);
|
||||
relatedPrimaryKey.value = get(item, [junctionField, relationPkField], null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user