diff options
Memoize t function in metamask-connect
-rw-r--r-- | ui/app/metamask-connect.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ui/app/metamask-connect.js b/ui/app/metamask-connect.js index 097be8dc3..8da594635 100644 --- a/ui/app/metamask-connect.js +++ b/ui/app/metamask-connect.js @@ -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 } } |