Skip to content

Commit 23cc1e0

Browse files
Revert #4446 due to regression
Fixed #4475 by rolling back #4446 - In `@rjsf/utils` rolled back the changes made by #4446 - Updated the `CHANGELOG.md` accordingly
1 parent 615a98c commit 23cc1e0

File tree

4 files changed

+17
-27
lines changed

4 files changed

+17
-27
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ should change the heading of the (upcoming) version to include a major version b
1717
-->
1818
# 5.24.3
1919

20+
## @rjsf/utils
21+
22+
- Rollback [4446](https://github.com/rjsf-team/react-jsonschema-form/pull/4446) due to regression
23+
2024
## Dev / docs / playground
2125
- Fixed issue with selector, where validator was getting refreshed on clicking on anything in selector. [#4472](https://github.com/rjsf-team/react-jsonschema-form/pull/4472)
2226

package-lock.json

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/utils/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"react": "^16.14.0 || >=17"
3737
},
3838
"dependencies": {
39-
"fast-equals": "^5.2.2",
4039
"json-schema-merge-allof": "^0.8.1",
4140
"jsonpointer": "^5.0.1",
4241
"lodash": "^4.17.21",

packages/utils/src/deepEquals.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
import { createCustomEqual } from 'fast-equals';
1+
import isEqualWith from 'lodash/isEqualWith';
22

3-
/** Implements a deep equals using the `fast-equals.createCustomEqual` function, providing a customized comparator that assumes all functions are equivalent.
3+
/** Implements a deep equals using the `lodash.isEqualWith` function, that provides a customized comparator that
4+
* assumes all functions are equivalent.
45
*
56
* @param a - The first element to compare
67
* @param b - The second element to compare
78
* @returns - True if the `a` and `b` are deeply equal, false otherwise
89
*/
9-
const deepEquals = createCustomEqual({
10-
createCustomConfig: () => ({
11-
// Assume all functions are equivalent
12-
// see https://github.com/rjsf-team/react-jsonschema-form/issues/255
13-
//
14-
// Performance improvement: knowing that typeof a === function, so, only needs to check if typeof b === function.
15-
// https://github.com/planttheidea/fast-equals/blob/c633c4e653cacf8fd5cbb309b6841df62322d74c/src/comparator.ts#L99
16-
areFunctionsEqual(_a, b) {
17-
return typeof b === 'function';
18-
},
19-
}),
20-
});
21-
22-
export default deepEquals;
10+
export default function deepEquals(a: any, b: any): boolean {
11+
return isEqualWith(a, b, (obj: any, other: any) => {
12+
if (typeof obj === 'function' && typeof other === 'function') {
13+
// Assume all functions are equivalent
14+
// see https://github.com/rjsf-team/react-jsonschema-form/issues/255
15+
return true;
16+
}
17+
return undefined; // fallback to default isEquals behavior
18+
});
19+
}

0 commit comments

Comments
 (0)