From 828321191a2a6411c56c8fa0711b22b2f80918b0 Mon Sep 17 00:00:00 2001 From: Yichuan Shen Date: Mon, 8 May 2017 23:42:32 +0200 Subject: [PATCH] Fix Sabaki not being able to undo a flatten node operation --- CHANGELOG.md | 1 + components/App.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 916c8469a..a491748d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. **Fixed** +* Fix Sabaki not being able to undo a flatten node operation * Fix Sabaki incorrectly setting `HA` and `AB` properties when there are no handicap stones * Fix Sabaki sometimes not saving comments when comment box is focused * Fix Sabaki crashing when checking for updates without internet connection diff --git a/components/App.js b/components/App.js index 8d6819339..59ae56c37 100644 --- a/components/App.js +++ b/components/App.js @@ -1138,7 +1138,7 @@ class App extends Component { // Navigation - setCurrentTreePosition(tree, index) { + setCurrentTreePosition(tree, index, {clearUndoPoint = true} = {}) { if (['scoring', 'estimator'].includes(this.state.mode)) return @@ -1148,7 +1148,7 @@ class App extends Component { t = t.parent } - if (t !== gametree.getRoot(this.state.treePosition[0])) { + if (clearUndoPoint && t !== gametree.getRoot(this.state.treePosition[0])) { this.clearUndoPoint() } @@ -1592,7 +1592,7 @@ class App extends Component { gameTrees[gameIndex] = clone this.setState({gameTrees}) - this.setCurrentTreePosition(clone, 0) + this.setCurrentTreePosition(clone, 0, {clearUndoPoint: false}) } makeMainVariation(tree, index, {setUndoPoint = true} = {}) {