mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Remove unnecessary shouldComponentUpdate
(#7875)
The `confirm-seed-phrase` component extends PureComponent, so it doesn't need a `shouldComponentUpdate` function. The state is effectively immutable, as all state is either a primitive type or is updated with new instances rather than mutation. Removing this function will silence a warning message printed to the console during e2e tests (React doesn't want you to set this function on `PureComponent`s). Removing this function also exposed an unused piece of state, which has also been removed.
This commit is contained in:
parent
206920e9bd
commit
6e49d0b5b5
@ -38,27 +38,6 @@ export default class ConfirmSeedPhrase extends PureComponent {
|
|||||||
pendingSeedIndices: [],
|
pendingSeedIndices: [],
|
||||||
draggingSeedIndex: -1,
|
draggingSeedIndex: -1,
|
||||||
hoveringIndex: -1,
|
hoveringIndex: -1,
|
||||||
isDragging: false,
|
|
||||||
}
|
|
||||||
|
|
||||||
shouldComponentUpdate (nextProps, nextState) {
|
|
||||||
const { seedPhrase } = this.props
|
|
||||||
const {
|
|
||||||
selectedSeedIndices,
|
|
||||||
shuffledSeedWords,
|
|
||||||
pendingSeedIndices,
|
|
||||||
draggingSeedIndex,
|
|
||||||
hoveringIndex,
|
|
||||||
isDragging,
|
|
||||||
} = this.state
|
|
||||||
|
|
||||||
return seedPhrase !== nextProps.seedPhrase ||
|
|
||||||
draggingSeedIndex !== nextState.draggingSeedIndex ||
|
|
||||||
isDragging !== nextState.isDragging ||
|
|
||||||
hoveringIndex !== nextState.hoveringIndex ||
|
|
||||||
selectedSeedIndices.join(' ') !== nextState.selectedSeedIndices.join(' ') ||
|
|
||||||
shuffledSeedWords.join(' ') !== nextState.shuffledSeedWords.join(' ') ||
|
|
||||||
pendingSeedIndices.join(' ') !== nextState.pendingSeedIndices.join(' ')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
|
Loading…
Reference in New Issue
Block a user