diff --git a/js/id/core/history.js b/js/id/core/history.js index 47c93c145..bfd0d5a8c 100644 --- a/js/id/core/history.js +++ b/js/id/core/history.js @@ -175,12 +175,7 @@ iD.History = function(context) { if (!lock) return; context.storage(getKey('lock'), null); - if (stack.length <= 1) { - context.storage(getKey('history'), null); - context.storage(getKey('nextIDs'), null); - context.storage(getKey('index'), null); - return; - } + if (stack.length <= 1) return; var json = JSON.stringify(stack.map(function(i) { return { @@ -198,6 +193,13 @@ iD.History = function(context) { context.storage(getKey('index'), index); }, + clearSaved: function() { + if (!lock) return; + context.storage(getKey('history'), null); + context.storage(getKey('nextIDs'), null); + context.storage(getKey('index'), null); + }, + lock: function() { if (context.storage(getKey('lock'))) return false; context.storage(getKey('lock'), true); diff --git a/js/id/ui/restore.js b/js/id/ui/restore.js index d15f80d96..c6996ff23 100644 --- a/js/id/ui/restore.js +++ b/js/id/ui/restore.js @@ -34,7 +34,8 @@ iD.ui.Restore = function(context) { .attr('class', 'cancel button col6') .text(t('restore.reset')) .on('click', function() { + context.history().clearSaved(); modal.remove(); }); - } + }; };