1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Memoize t function in metamask-connect

This commit is contained in:
Dan 2018-03-23 14:21:32 -02:30
parent b9309f689b
commit 11a30378d7

View File

@ -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
}
}