diff --git a/src/components/package.json b/src/components/package.json index b8b605ad1..da27e9a1b 100644 --- a/src/components/package.json +++ b/src/components/package.json @@ -23,9 +23,11 @@ "dependencies": { "@eva-design/dss": "^2.0.0", "@eva-design/processor": "^2.0.0", + "fecha": "3.0.3", "hoist-non-react-statics": "^3.2.1", "lodash.merge": "^4.6.1", - "fecha": "3.0.3" + "memoize-one": "^5.1.1", + "react-fast-compare": "^3.2.0" }, "peerDependencies": { "react-native-svg": "^9.13.6" diff --git a/src/components/theme/style/styleConsumer.service.ts b/src/components/theme/style/styleConsumer.service.ts index f8c908c82..772a05a7d 100644 --- a/src/components/theme/style/styleConsumer.service.ts +++ b/src/components/theme/style/styleConsumer.service.ts @@ -9,6 +9,8 @@ import { ControlThemedStyleType, ThemedStyleType, } from '@eva-design/dss'; +import isEqual from 'react-fast-compare'; +import memoizeOne from 'memoize-one'; import { StyledComponentProps } from './styled'; import { Interaction, @@ -49,6 +51,8 @@ export class StyleConsumerService { console.error(message); } + + this.getGeneratedStyleMapping = memoizeOne(this.getGeneratedStyleMapping.bind(this), isEqual) } public createDefaultProps
(): StyledComponentProps { diff --git a/yarn.lock b/yarn.lock index 54e813921..c641c93ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10105,6 +10105,11 @@ mem@^4.0.0: mimic-fn "^2.0.0" p-is-promise "^2.0.0" +memoize-one@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-5.1.1.tgz#047b6e3199b508eaec03504de71229b8eb1d75c0" + integrity sha512-HKeeBpWvqiVJD57ZUAsJNm71eHTykffzcLZVYWiVfQeI1rJtuEaS7hQiEpWfVVk18donPwJEcFKIkCmPJNOhHA== + memory-fs@^0.4.0, memory-fs@^0.4.1, memory-fs@~0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.4.1.tgz#3a9a20b8462523e447cfbc7e8bb80ed667bfc552" @@ -12741,6 +12746,11 @@ react-error-overlay@^6.0.1: resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.7.tgz#1dcfb459ab671d53f660a991513cb2f0a0553108" integrity sha512-TAv1KJFh3RhqxNvhzxj6LeT5NWklP6rDr2a0jaTfsZ5wSZWHOGeqQyejUp3xxLfPt2UpyJEcVQB/zyPcmonNFA== +react-fast-compare@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb" + integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA== + react-is@^16.12.0, react-is@^16.13.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.9.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"