aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/tx-state-history-helper.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/lib/tx-state-history-helper.js')
-rw-r--r--app/scripts/lib/tx-state-history-helper.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/scripts/lib/tx-state-history-helper.js b/app/scripts/lib/tx-state-history-helper.js
index 304069d57..db6e3bc9f 100644
--- a/app/scripts/lib/tx-state-history-helper.js
+++ b/app/scripts/lib/tx-state-history-helper.js
@@ -20,11 +20,15 @@ function migrateFromSnapshotsToDiffs(longHistory) {
)
}
-function generateHistoryEntry(previousState, newState) {
- return jsonDiffer.compare(previousState, newState)
+function generateHistoryEntry(previousState, newState, note) {
+ const entry = jsonDiffer.compare(previousState, newState)
+ // Add a note to the first op, since it breaks if we append it to the entry
+ if (note && entry[0]) entry[0].note = note
+ return entry
}
-function replayHistory(shortHistory) {
+function replayHistory(_shortHistory) {
+ const shortHistory = clone(_shortHistory)
return shortHistory.reduce((val, entry) => jsonDiffer.applyPatch(val, entry).newDocument)
}