aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/migrations/023.js
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2018-04-06 10:28:53 +0800
committerfrankiebee <frankie.diamond@gmail.com>2018-04-06 10:33:10 +0800
commitd4e30040a2186a1320a44f86849506729b2dafad (patch)
tree33c8a0cbe3fccfd6d27c3ea06bd242c05bdeb293 /app/scripts/migrations/023.js
parent7d243aacf9db9dc8e3e2e3acfc54298ffc06fe12 (diff)
downloadtangerine-wallet-browser-d4e30040a2186a1320a44f86849506729b2dafad.tar.gz
tangerine-wallet-browser-d4e30040a2186a1320a44f86849506729b2dafad.tar.zst
tangerine-wallet-browser-d4e30040a2186a1320a44f86849506729b2dafad.zip
migrations - back fixes
Diffstat (limited to 'app/scripts/migrations/023.js')
-rw-r--r--app/scripts/migrations/023.js38
1 files changed, 21 insertions, 17 deletions
diff --git a/app/scripts/migrations/023.js b/app/scripts/migrations/023.js
index bce0a5bea..151496b06 100644
--- a/app/scripts/migrations/023.js
+++ b/app/scripts/migrations/023.js
@@ -28,23 +28,27 @@ module.exports = {
function transformState (state) {
const newState = state
- const transactions = newState.TransactionController.transactions
-
- if (transactions.length <= 40) return newState
-
- let reverseTxList = transactions.reverse()
- let stripping = true
- while (reverseTxList.length > 40 && stripping) {
- let txIndex = reverseTxList.findIndex((txMeta) => {
- return (txMeta.status === 'failed' ||
- txMeta.status === 'rejected' ||
- txMeta.status === 'confirmed' ||
- txMeta.status === 'dropped')
- })
- if (txIndex < 0) stripping = false
- else reverseTxList.splice(txIndex, 1)
- }
- newState.TransactionController.transactions = reverseTxList.reverse()
+ const { TransactionController } = newState
+ if (TransactionController && TransactionController.transactions) {
+ const transactions = newState.TransactionController.transactions
+
+ if (transactions.length <= 40) return newState
+
+ let reverseTxList = transactions.reverse()
+ let stripping = true
+ while (reverseTxList.length > 40 && stripping) {
+ let txIndex = reverseTxList.findIndex((txMeta) => {
+ return (txMeta.status === 'failed' ||
+ txMeta.status === 'rejected' ||
+ txMeta.status === 'confirmed' ||
+ txMeta.status === 'dropped')
+ })
+ if (txIndex < 0) stripping = false
+ else reverseTxList.splice(txIndex, 1)
+ }
+
+ newState.TransactionController.transactions = reverseTxList.reverse()
+ }
return newState
}