Skip to content

Commit b4dee2f

Browse files
authored
Merge pull request #7112 from marmelab/fix-pristine-arrayinput
Fix `ArrayInput` could make the form dirty on initialization
2 parents da2996e + 7234bd6 commit b4dee2f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/ra-ui-materialui/src/input/ArrayInput/ArrayInput.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react';
22
import { cloneElement, Children, ReactElement } from 'react';
33
import PropTypes from 'prop-types';
4+
import isEqual from 'lodash/isEqual';
45
import {
56
isRequired,
67
FieldTitle,
@@ -83,6 +84,8 @@ export const ArrayInput = (props: ArrayInputProps) => {
8384
initialValue: defaultValue,
8485
validate: sanitizedValidate,
8586
...rest,
87+
isEqual: (allPreviousValues, allNewValues) =>
88+
isEqual(allPreviousValues, allNewValues),
8689
});
8790

8891
if (loading) {

0 commit comments

Comments
 (0)