mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +01:00
Memoize t function in metamask-connect
This commit is contained in:
parent
b9309f689b
commit
11a30378d7
@ -9,11 +9,17 @@ const metamaskConnect = (mapStateToProps, mapDispatchToProps) => {
|
||||
}
|
||||
|
||||
const _higherOrderMapStateToProps = (mapStateToProps) => {
|
||||
let _t
|
||||
let currentLocale
|
||||
return (state, ownProps = {}) => {
|
||||
const stateProps = mapStateToProps
|
||||
? mapStateToProps(state, ownProps)
|
||||
: ownProps
|
||||
stateProps.t = t.bind(null, state.localeMessages)
|
||||
if (currentLocale !== state.metamask.currentLocale) {
|
||||
currentLocale = state.metamask.currentLocale
|
||||
_t = t.bind(null, state.localeMessages)
|
||||
}
|
||||
stateProps.t = _t
|
||||
return stateProps
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user