From 2632c8222859ed14e69c8437baed852f170f4f3c Mon Sep 17 00:00:00 2001 From: Ryan Yurkanin Date: Wed, 6 Sep 2017 14:51:18 -0400 Subject: [PATCH] Fix hasUndos and hasRedos (#1053) * tiny fix for hasUndos/hasRedos computed values * clear redos when saving while redos are on the history stack * Update history.js --- src/models/history.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/models/history.js b/src/models/history.js index 1a1a45c03..3621faa68 100644 --- a/src/models/history.js +++ b/src/models/history.js @@ -80,7 +80,7 @@ class History extends new Record(DEFAULTS) { save(operation, options = {}) { let history = this - let { undos } = history + let { undos, redos } = history let { merge, skip } = options const prevBatch = undos.peek() const prevOperation = prevBatch && prevBatch[prevBatch.length - 1] @@ -118,7 +118,9 @@ class History extends new Record(DEFAULTS) { undos = undos.take(100) } - history = history.set('undos', undos) + // Clear the redos and update the history. + redos = redos.clear() + history = history.set('undos', undos).set('redos', redos) return history }