fix applying corresponding changes (#17392)

This commit is contained in:
Nitwel
2023-02-03 16:01:42 +01:00
committed by GitHub
parent 73c7b161c7
commit cc7d3db099

View File

@@ -2,6 +2,7 @@ import { StateUpdates, State, HelperFunctions } from '../types';
import { set } from 'lodash';
import { useCollectionsStore } from '@/stores/collections';
import { useFieldsStore } from '@/stores/fields';
import { setRelatedOneFieldForCorrespondingField } from './m2m';
export function applyChanges(updates: StateUpdates, state: State, helperFn: HelperFunctions) {
const { hasChanged } = helperFn;
@@ -37,6 +38,10 @@ export function applyChanges(updates: StateUpdates, state: State, helperFn: Help
matchJunctionCollectionName(updates);
}
if (hasChanged('fields.corresponding')) {
setRelatedOneFieldForCorrespondingField(updates);
}
if (
[
'relations.o2m.collection',