aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/migrations/018.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-04-10 03:22:26 +0800
committerDan <danjm.com@gmail.com>2018-04-10 03:22:26 +0800
commit2c4426e4de745be880a994674dc1dc74c7ec74eb (patch)
tree1de9b836026d3222b490793099b66372404b83ab /app/scripts/migrations/018.js
parent9dbb9d12ad31d53b8911db171cb7d6b3fcb477e2 (diff)
parent4cae3d3b0d2a9cc0279e44de256e7fc7e219dca1 (diff)
downloadtangerine-wallet-browser-2c4426e4de745be880a994674dc1dc74c7ec74eb.tar.gz
tangerine-wallet-browser-2c4426e4de745be880a994674dc1dc74c7ec74eb.tar.zst
tangerine-wallet-browser-2c4426e4de745be880a994674dc1dc74c7ec74eb.zip
Merge branch 'master' into i3580-InternationalizeCurrency
Diffstat (limited to 'app/scripts/migrations/018.js')
-rw-r--r--app/scripts/migrations/018.js39
1 files changed, 21 insertions, 18 deletions
diff --git a/app/scripts/migrations/018.js b/app/scripts/migrations/018.js
index d27fe3f46..bea1fe3da 100644
--- a/app/scripts/migrations/018.js
+++ b/app/scripts/migrations/018.js
@@ -29,24 +29,27 @@ module.exports = {
function transformState (state) {
const newState = state
- const transactions = newState.TransactionController.transactions
- newState.TransactionController.transactions = transactions.map((txMeta) => {
- // no history: initialize
- if (!txMeta.history || txMeta.history.length === 0) {
- const snapshot = txStateHistoryHelper.snapshotFromTxMeta(txMeta)
- txMeta.history = [snapshot]
+ const { TransactionController } = newState
+ if (TransactionController && TransactionController.transactions) {
+ const transactions = newState.TransactionController.transactions
+ newState.TransactionController.transactions = transactions.map((txMeta) => {
+ // no history: initialize
+ if (!txMeta.history || txMeta.history.length === 0) {
+ const snapshot = txStateHistoryHelper.snapshotFromTxMeta(txMeta)
+ txMeta.history = [snapshot]
+ return txMeta
+ }
+ // has history: migrate
+ const newHistory = (
+ txStateHistoryHelper.migrateFromSnapshotsToDiffs(txMeta.history)
+ // remove empty diffs
+ .filter((entry) => {
+ return !Array.isArray(entry) || entry.length > 0
+ })
+ )
+ txMeta.history = newHistory
return txMeta
- }
- // has history: migrate
- const newHistory = (
- txStateHistoryHelper.migrateFromSnapshotsToDiffs(txMeta.history)
- // remove empty diffs
- .filter((entry) => {
- return !Array.isArray(entry) || entry.length > 0
- })
- )
- txMeta.history = newHistory
- return txMeta
- })
+ })
+ }
return newState
}