mirror of
https://github.com/strapi/strapi.git
synced 2025-12-06 03:52:38 +00:00
fix border case with CT with relations with admin users
This commit is contained in:
parent
d1540bf7ee
commit
a282679b8a
@ -237,14 +237,16 @@ const reducer = (state, action) =>
|
|||||||
const findAllRelationsAndReplaceWithEmptyArray = findAllAndReplace(
|
const findAllRelationsAndReplaceWithEmptyArray = findAllAndReplace(
|
||||||
components,
|
components,
|
||||||
(value) => {
|
(value) => {
|
||||||
// We don't want to replace relations with admin users
|
|
||||||
if (value.target === 'admin::user') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value.type === 'relation';
|
return value.type === 'relation';
|
||||||
},
|
},
|
||||||
(_, { path }) => {
|
(value, { path }) => {
|
||||||
|
const relationFieldName = path[path.length - 1];
|
||||||
|
|
||||||
|
// We don't want to fetch the relations with creator fields because we already have it
|
||||||
|
if (relationFieldName === 'createdBy' || relationFieldName === 'updatedBy') {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
if (state.modifiedData?.id === data.id && get(state.modifiedData, path)) {
|
if (state.modifiedData?.id === data.id && get(state.modifiedData, path)) {
|
||||||
return get(state.modifiedData, path);
|
return get(state.modifiedData, path);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user