From a4bc08157dfcda87b2f1290bd0701906534dd9b6 Mon Sep 17 00:00:00 2001 From: Aaron Imming Date: Thu, 7 Feb 2019 14:14:31 +0800 Subject: [PATCH 1/2] Move clearUndo() to correct place --- src/botPage/view/blockly/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/botPage/view/blockly/index.js b/src/botPage/view/blockly/index.js index 50efc8d34a..862b613f58 100644 --- a/src/botPage/view/blockly/index.js +++ b/src/botPage/view/blockly/index.js @@ -243,11 +243,11 @@ export default class _Blockly { this.blocksXmlStr = Blockly.Xml.domToPrettyText(main); Blockly.Xml.domToWorkspace(main.getElementsByTagName('xml')[0], workspace); this.zoomOnPlusMinus(); - Blockly.mainWorkspace.clearUndo(); disposeBlocksWithLoaders(); setTimeout(() => { setBeforeUnload(true); Blockly.mainWorkspace.cleanUp(); + Blockly.mainWorkspace.clearUndo(); }, 0); resolve(); }); From 7b4ba4cd073108fad4cc5f4dfb8934327d53f584 Mon Sep 17 00:00:00 2001 From: Aaron Imming Date: Thu, 7 Feb 2019 14:14:53 +0800 Subject: [PATCH 2/2] Don't record duration changes in redo/undo --- src/botPage/view/blockly/blocks/trade/tradeOptions.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/botPage/view/blockly/blocks/trade/tradeOptions.js b/src/botPage/view/blockly/blocks/trade/tradeOptions.js index 40cbadc6e5..965d5d8fa4 100644 --- a/src/botPage/view/blockly/blocks/trade/tradeOptions.js +++ b/src/botPage/view/blockly/blocks/trade/tradeOptions.js @@ -38,9 +38,13 @@ export default () => { const tradeType = getTradeType(this); const prevSelectedDuration = durationTypeList.getValue(); + + Blockly.Events.recordUndo = false; this.setFieldValue(translate('Loading...'), 'DURATIONTYPE_LIST'); + Blockly.Events.recordUndo = true; getAvailableDurations(symbol, tradeType).then(durations => { + Blockly.Events.recordUndo = false; // Prevent UI flickering by only updating field if options have changed // eslint-disable-next-line no-underscore-dangle if (JSON.stringify(durationTypeList.menuGenerator_) !== JSON.stringify(durations)) { @@ -56,6 +60,7 @@ export default () => { } else { this.setFieldValue(translate('Not available'), 'DURATIONTYPE_LIST'); } + Blockly.Events.recordUndo = true; }); } }