Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching "deep-equal" package for "fast-deep-equal". #1665

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"axios": "^1.2.0",
"bootstrap": "^5.2.3",
"cross-fetch": "^3.1.5",
"deep-equal": "^2.1.0",
"fast-deep-equal": "3.1.3",
"graphql": "~16.6.0",
"graphql-tag": "~2.12.6",
"i18next": "^22.0.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { Placeholder, VisitorIdentification } from '@sitecore-jss/sitecore-jss-react';
import { NavLink } from 'react-router-dom';
import { withTranslation } from 'react-i18next';
import deepEqual from 'deep-equal';
import fastDeepEqual from 'fast-deep-equal/es6/react';
import Helmet from 'react-helmet';

// Using bootstrap is completely optional. It's used here to provide a clean layout for samples,
Expand Down Expand Up @@ -82,7 +82,7 @@ const Layout = ({ route }) => (
// We don't want to re-render `Layout` when route is changed but layout data is not loaded
// Layout will be re-rendered only when layout data is changed
const propsAreEqual = (prevProps, nextProps) => {
if (deepEqual(prevProps.route, nextProps.route)) return true;
if (fastDeepEqual(prevProps.route, nextProps.route)) return true;

return false;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/sitecore-jss-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "21.7.0-canary.13",
"deep-equal": "^2.1.0",
"fast-deep-equal": "3.1.3",
"prop-types": "^15.8.1",
"style-attr": "^1.3.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import React from 'react';
import PropTypes from 'prop-types';
import deepEqual from 'deep-equal';
import fastDeepEqual from 'fast-deep-equal/es6/react';
import { ComponentFactory } from './sharedTypes';
import { LayoutServiceContext, LayoutServiceData, RouteData } from '../index';

Expand Down Expand Up @@ -70,7 +70,7 @@ export class SitecoreContext extends React.Component<SitecoreContextProps, Sitec
componentDidUpdate(prevProps: SitecoreContextProps) {
// In case if somebody will manage SitecoreContext state by passing fresh `layoutData` prop
// instead of using `updateSitecoreContext`
if (!deepEqual(prevProps.layoutData, this.props.layoutData)) {
if (!fastDeepEqual(prevProps.layoutData, this.props.layoutData)) {
this.setContext(this.props.layoutData);

return;
Expand Down
147 changes: 4 additions & 143 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6814,11 +6814,11 @@ __metadata:
chai: ^4.3.7
chai-string: ^1.5.0
cheerio: 1.0.0-rc.12
deep-equal: ^2.1.0
del-cli: ^5.0.0
enzyme: ^3.11.0
eslint: ^8.28.0
eslint-plugin-react: ^7.31.11
fast-deep-equal: 3.1.3
jsdom: ^20.0.3
mocha: ^10.2.0
nyc: ^15.1.0
Expand Down Expand Up @@ -9746,13 +9746,6 @@ __metadata:
languageName: node
linkType: hard

"available-typed-arrays@npm:^1.0.5":
version: 1.0.5
resolution: "available-typed-arrays@npm:1.0.5"
checksum: 20eb47b3cefd7db027b9bbb993c658abd36d4edd3fe1060e83699a03ee275b0c9b216cc076ff3f2db29073225fb70e7613987af14269ac1fe2a19803ccc97f1a
languageName: node
linkType: hard

"aws-sign2@npm:~0.7.0":
version: 0.7.0
resolution: "aws-sign2@npm:0.7.0"
Expand Down Expand Up @@ -12933,29 +12926,6 @@ __metadata:
languageName: node
linkType: hard

"deep-equal@npm:^2.1.0":
version: 2.1.0
resolution: "deep-equal@npm:2.1.0"
dependencies:
call-bind: ^1.0.2
es-get-iterator: ^1.1.2
get-intrinsic: ^1.1.3
is-arguments: ^1.1.1
is-date-object: ^1.0.5
is-regex: ^1.1.4
isarray: ^2.0.5
object-is: ^1.1.5
object-keys: ^1.1.1
object.assign: ^4.1.4
regexp.prototype.flags: ^1.4.3
side-channel: ^1.0.4
which-boxed-primitive: ^1.0.2
which-collection: ^1.0.1
which-typed-array: ^1.1.8
checksum: a3efc772f14372d2a88bb1e414ab2218cf23cc77673521bbccbb2fc128dd8b6cccfad05eb35b9a8a4669bd7f3ecebaa137beebdf549b7be56c617bd5488ca987
languageName: node
linkType: hard

"deep-is@npm:^0.1.3, deep-is@npm:~0.1.3":
version: 0.1.4
resolution: "deep-is@npm:0.1.4"
Expand Down Expand Up @@ -13931,22 +13901,6 @@ __metadata:
languageName: node
linkType: hard

"es-get-iterator@npm:^1.1.2":
version: 1.1.2
resolution: "es-get-iterator@npm:1.1.2"
dependencies:
call-bind: ^1.0.2
get-intrinsic: ^1.1.0
has-symbols: ^1.0.1
is-arguments: ^1.1.0
is-map: ^2.0.2
is-set: ^2.0.2
is-string: ^1.0.5
isarray: ^2.0.5
checksum: f75e66acb6a45686fa08b3ade9c9421a70d36a0c43ed4363e67f4d7aab2226cb73dd977cb48abbaf75721b946d3cd810682fcf310c7ad0867802fbf929b17dcf
languageName: node
linkType: hard

"es-module-lexer@npm:^0.9.0":
version: 0.9.3
resolution: "es-module-lexer@npm:0.9.3"
Expand Down Expand Up @@ -15111,7 +15065,7 @@ __metadata:
languageName: node
linkType: hard

"fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3":
"fast-deep-equal@npm:3.1.3, fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3":
version: 3.1.3
resolution: "fast-deep-equal@npm:3.1.3"
checksum: e21a9d8d84f53493b6aa15efc9cfd53dd5b714a1f23f67fb5dc8f574af80df889b3bce25dc081887c6d25457cce704e636395333abad896ccdec03abaf1f3f9d
Expand Down Expand Up @@ -16155,15 +16109,6 @@ __metadata:
languageName: node
linkType: hard

"gopd@npm:^1.0.1":
version: 1.0.1
resolution: "gopd@npm:1.0.1"
dependencies:
get-intrinsic: ^1.1.3
checksum: a5ccfb8806e0917a94e0b3de2af2ea4979c1da920bc381667c260e00e7cafdbe844e2cb9c5bcfef4e5412e8bf73bab837285bc35c7ba73aaaf0134d4583393a6
languageName: node
linkType: hard

"got@npm:^11.8.5":
version: 11.8.6
resolution: "got@npm:11.8.6"
Expand Down Expand Up @@ -17216,16 +17161,6 @@ __metadata:
languageName: node
linkType: hard

"is-arguments@npm:^1.1.0, is-arguments@npm:^1.1.1":
version: 1.1.1
resolution: "is-arguments@npm:1.1.1"
dependencies:
call-bind: ^1.0.2
has-tostringtag: ^1.0.0
checksum: 7f02700ec2171b691ef3e4d0e3e6c0ba408e8434368504bb593d0d7c891c0dbfda6d19d30808b904a6cb1929bca648c061ba438c39f296c2a8ca083229c49f27
languageName: node
linkType: hard

"is-arrayish@npm:^0.2.1":
version: 0.2.1
resolution: "is-arrayish@npm:0.2.1"
Expand Down Expand Up @@ -17338,7 +17273,7 @@ __metadata:
languageName: node
linkType: hard

"is-date-object@npm:^1.0.1, is-date-object@npm:^1.0.5":
"is-date-object@npm:^1.0.1":
version: 1.0.5
resolution: "is-date-object@npm:1.0.5"
dependencies:
Expand Down Expand Up @@ -17468,13 +17403,6 @@ __metadata:
languageName: node
linkType: hard

"is-map@npm:^2.0.1, is-map@npm:^2.0.2":
version: 2.0.2
resolution: "is-map@npm:2.0.2"
checksum: ace3d0ecd667bbdefdb1852de601268f67f2db725624b1958f279316e13fecb8fa7df91fd60f690d7417b4ec180712f5a7ee967008e27c65cfd475cc84337728
languageName: node
linkType: hard

"is-module@npm:^1.0.0":
version: 1.0.0
resolution: "is-module@npm:1.0.0"
Expand Down Expand Up @@ -17610,13 +17538,6 @@ __metadata:
languageName: node
linkType: hard

"is-set@npm:^2.0.1, is-set@npm:^2.0.2":
version: 2.0.2
resolution: "is-set@npm:2.0.2"
checksum: b64343faf45e9387b97a6fd32be632ee7b269bd8183701f3b3f5b71a7cf00d04450ed8669d0bd08753e08b968beda96fca73a10fd0ff56a32603f64deba55a57
languageName: node
linkType: hard

"is-shared-array-buffer@npm:^1.0.1":
version: 1.0.1
resolution: "is-shared-array-buffer@npm:1.0.1"
Expand Down Expand Up @@ -17690,19 +17611,6 @@ __metadata:
languageName: node
linkType: hard

"is-typed-array@npm:^1.1.10":
version: 1.1.10
resolution: "is-typed-array@npm:1.1.10"
dependencies:
available-typed-arrays: ^1.0.5
call-bind: ^1.0.2
for-each: ^0.3.3
gopd: ^1.0.1
has-tostringtag: ^1.0.0
checksum: aac6ecb59d4c56a1cdeb69b1f129154ef462bbffe434cb8a8235ca89b42f258b7ae94073c41b3cb7bce37f6a1733ad4499f07882d5d5093a7ba84dfc4ebb8017
languageName: node
linkType: hard

"is-typedarray@npm:^1.0.0, is-typedarray@npm:~1.0.0":
version: 1.0.0
resolution: "is-typedarray@npm:1.0.0"
Expand All @@ -17717,13 +17625,6 @@ __metadata:
languageName: node
linkType: hard

"is-weakmap@npm:^2.0.1":
version: 2.0.1
resolution: "is-weakmap@npm:2.0.1"
checksum: 1222bb7e90c32bdb949226e66d26cb7bce12e1e28e3e1b40bfa6b390ba3e08192a8664a703dff2a00a84825f4e022f9cd58c4599ff9981ab72b1d69479f4f7f6
languageName: node
linkType: hard

"is-weakref@npm:^1.0.1":
version: 1.0.1
resolution: "is-weakref@npm:1.0.1"
Expand All @@ -17742,13 +17643,6 @@ __metadata:
languageName: node
linkType: hard

"is-weakset@npm:^2.0.1":
version: 2.0.1
resolution: "is-weakset@npm:2.0.1"
checksum: 70b62ccb14e44f6d0cc4ce8232f5e9edcf5c8123d0e315d4e42829816eb7a85b3763300e32aaa0eaf36d83877b8b140722e96269e58e74e5c5c258f48c4e8693
languageName: node
linkType: hard

"is-what@npm:^3.12.0":
version: 3.14.1
resolution: "is-what@npm:3.14.1"
Expand Down Expand Up @@ -17793,13 +17687,6 @@ __metadata:
languageName: node
linkType: hard

"isarray@npm:^2.0.5":
version: 2.0.5
resolution: "isarray@npm:2.0.5"
checksum: bd5bbe4104438c4196ba58a54650116007fa0262eccef13a4c55b2e09a5b36b59f1e75b9fcc49883dd9d4953892e6fc007eef9e9155648ceea036e184b0f930a
languageName: node
linkType: hard

"isbinaryfile@npm:^4.0.8":
version: 4.0.8
resolution: "isbinaryfile@npm:4.0.8"
Expand Down Expand Up @@ -22498,7 +22385,7 @@ __metadata:
languageName: node
linkType: hard

"object-is@npm:^1.0.2, object-is@npm:^1.1.2, object-is@npm:^1.1.5":
"object-is@npm:^1.0.2, object-is@npm:^1.1.2":
version: 1.1.5
resolution: "object-is@npm:1.1.5"
dependencies:
Expand Down Expand Up @@ -28702,39 +28589,13 @@ __metadata:
languageName: node
linkType: hard

"which-collection@npm:^1.0.1":
version: 1.0.1
resolution: "which-collection@npm:1.0.1"
dependencies:
is-map: ^2.0.1
is-set: ^2.0.1
is-weakmap: ^2.0.1
is-weakset: ^2.0.1
checksum: c815bbd163107ef9cb84f135e6f34453eaf4cca994e7ba85ddb0d27cea724c623fae2a473ceccfd5549c53cc65a5d82692de418166df3f858e1e5dc60818581c
languageName: node
linkType: hard

"which-module@npm:^2.0.0":
version: 2.0.0
resolution: "which-module@npm:2.0.0"
checksum: 809f7fd3dfcb2cdbe0180b60d68100c88785084f8f9492b0998c051d7a8efe56784492609d3f09ac161635b78ea29219eb1418a98c15ce87d085bce905705c9c
languageName: node
linkType: hard

"which-typed-array@npm:^1.1.8":
version: 1.1.9
resolution: "which-typed-array@npm:1.1.9"
dependencies:
available-typed-arrays: ^1.0.5
call-bind: ^1.0.2
for-each: ^0.3.3
gopd: ^1.0.1
has-tostringtag: ^1.0.0
is-typed-array: ^1.1.10
checksum: fe0178ca44c57699ca2c0e657b64eaa8d2db2372a4e2851184f568f98c478ae3dc3fdb5f7e46c384487046b0cf9e23241423242b277e03e8ba3dabc7c84c98ef
languageName: node
linkType: hard

"which@npm:^1.2.1, which@npm:^1.2.9, which@npm:^1.3.0":
version: 1.3.1
resolution: "which@npm:1.3.1"
Expand Down