mirror of
https://github.com/directus/directus.git
synced 2026-01-28 06:08:01 -05:00
fix translations not using language table name (#12461)
This commit is contained in:
@@ -18,6 +18,7 @@ export function applyChanges(updates: StateUpdates, state: State, helperFn: Help
|
||||
|
||||
if (hasChanged('relations.m2o.related_collection')) {
|
||||
preventCircularConstraint(updates, state, helperFn);
|
||||
updateJunctionRelated(updates, state, helperFn);
|
||||
}
|
||||
|
||||
if (hasChanged('relations.o2m.field')) {
|
||||
@@ -108,6 +109,16 @@ export function setJunctionFields(updates: StateUpdates, _state: State, { getCur
|
||||
set(updates, 'relations.m2o.meta.junction_field', getCurrent('relations.o2m.field'));
|
||||
}
|
||||
|
||||
export function updateJunctionRelated(updates: StateUpdates, _state: State, { getCurrent }: HelperFunctions) {
|
||||
const fieldsStore = useFieldsStore();
|
||||
|
||||
const relatedCollection = getCurrent('relations.m2o.related_collection');
|
||||
const relatedCollectionPrimaryKeyField =
|
||||
fieldsStore.getPrimaryKeyFieldForCollection(relatedCollection)?.field ?? 'id';
|
||||
|
||||
set(updates, 'relations.m2o.field', `${relatedCollection}_${relatedCollectionPrimaryKeyField}`);
|
||||
}
|
||||
|
||||
function collectionExists(collection: string) {
|
||||
return !!useCollectionsStore().getCollection(collection);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user