perf(word-cloud): reduce render to improve performance (#21504)

This commit is contained in:
Stephen Liu 2022-09-19 20:08:36 +08:00 committed by GitHub
parent 7d2f07e78f
commit 94a724e49b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -36,6 +36,7 @@
},
"peerDependencies": {
"@types/react": "*",
"@types/lodash": "*",
"@superset-ui/chart-controls": "*",
"@superset-ui/core": "*",
"react": "^16.13.1"

View File

@ -31,6 +31,7 @@ import {
seed,
CategoricalColorScale,
} from '@superset-ui/core';
import { isEqual } from 'lodash';
const seedRandom = seed('superset-ui');
export const ROTATION = {
@ -134,8 +135,8 @@ class WordCloud extends React.PureComponent<
const { data, encoding, width, height, rotation } = this.props;
if (
prevProps.data !== data ||
prevProps.encoding !== encoding ||
!isEqual(prevProps.data, data) ||
!isEqual(prevProps.encoding, encoding) ||
prevProps.width !== width ||
prevProps.height !== height ||
prevProps.rotation !== rotation