mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 07:03:38 +00:00
Merge pull request #3768 from strapi/fix/edit-group
Fix bug when editing an existing entry that did not have a group
This commit is contained in:
commit
cf3df913e0
@ -1,7 +1,7 @@
|
||||
import React, { useEffect, useReducer, memo } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { get } from 'lodash';
|
||||
import { get, size } from 'lodash';
|
||||
|
||||
import pluginId from '../../pluginId';
|
||||
import { useEditView } from '../../contexts/EditView';
|
||||
@ -72,7 +72,7 @@ function Group({
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [didCheckErrors]);
|
||||
|
||||
const groupValueLength = groupValue.length;
|
||||
const groupValueLength = size(groupValue);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@ -54,7 +54,9 @@ export const cleanData = (retrievedData, ctLayout, groupLayouts) => {
|
||||
})
|
||||
: value;
|
||||
} else {
|
||||
cleanedData = recursiveCleanData(value, groupLayouts[group]);
|
||||
cleanedData = value
|
||||
? recursiveCleanData(value, groupLayouts[group])
|
||||
: value;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -62,7 +62,9 @@ const createYupSchema = (model, { groups }) => {
|
||||
? yup.array().of(groupSchema)
|
||||
: groupSchema;
|
||||
groupSchema =
|
||||
attribute.required === true ? groupSchema.defined() : groupSchema;
|
||||
attribute.required === true
|
||||
? groupSchema.defined()
|
||||
: groupSchema.nullable();
|
||||
acc[current] = groupSchema;
|
||||
}
|
||||
return acc;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user