aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-03-24 00:51:32 +0800
committerDan <danjm.com@gmail.com>2018-03-24 00:51:32 +0800
commit11a30378d7aea9d5e331ff52f61b136820a54fb1 (patch)
tree7c9b60239b2065c4bef3b80c637735177ca0544b
parentb9309f689be7f55fde0a32a6e576784aa9fc1061 (diff)
downloadtangerine-wallet-browser-11a30378d7aea9d5e331ff52f61b136820a54fb1.tar
tangerine-wallet-browser-11a30378d7aea9d5e331ff52f61b136820a54fb1.tar.gz
tangerine-wallet-browser-11a30378d7aea9d5e331ff52f61b136820a54fb1.tar.bz2
tangerine-wallet-browser-11a30378d7aea9d5e331ff52f61b136820a54fb1.tar.lz
tangerine-wallet-browser-11a30378d7aea9d5e331ff52f61b136820a54fb1.tar.xz
tangerine-wallet-browser-11a30378d7aea9d5e331ff52f61b136820a54fb1.tar.zst
tangerine-wallet-browser-11a30378d7aea9d5e331ff52f61b136820a54fb1.zip
Memoize t function in metamask-connect
-rw-r--r--ui/app/metamask-connect.js8
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
}
}