mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix translations relationship setup not syncing o2m col to m2o (#10248)
Fixes #9934
This commit is contained in:
@@ -28,6 +28,10 @@ export function applyChanges(updates: StateUpdates, state: State, helperFn: Help
|
||||
setJunctionFields(updates, state, helperFn);
|
||||
}
|
||||
|
||||
if (hasChanged('relations.o2m.collection') || hasChanged('relations.m2o.collection')) {
|
||||
matchJunctionCollectionName(updates);
|
||||
}
|
||||
|
||||
if (
|
||||
[
|
||||
'relations.o2m.collection',
|
||||
@@ -292,6 +296,16 @@ export function setDefaults(updates: StateUpdates, state: State, { getCurrent }:
|
||||
}
|
||||
}
|
||||
|
||||
export function matchJunctionCollectionName(updates: StateUpdates) {
|
||||
if (updates?.relations?.o2m?.collection && updates.relations.o2m.collection !== updates.relations.m2o?.collection) {
|
||||
set(updates, 'relations.m2o.collection', updates.relations.o2m.collection);
|
||||
}
|
||||
|
||||
if (updates?.relations?.m2o?.collection && updates.relations.m2o.collection !== updates.relations.o2m?.collection) {
|
||||
set(updates, 'relations.o2m.collection', updates.relations.m2o.collection);
|
||||
}
|
||||
}
|
||||
|
||||
export function getAutomaticJunctionCollectionName(collectionA: string) {
|
||||
let index = 0;
|
||||
let name = getName(index);
|
||||
|
||||
Reference in New Issue
Block a user