From 697ee5803b6110b98de0e1097ce6affc712134c4 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Tue, 28 Jan 2020 12:00:49 +0100
Subject: [PATCH] Fix. TODO: Vue reactivity on game.score and game. ...

---
 client/src/components/BaseGame.vue | 6 ++++++
 client/src/components/MoveList.vue | 2 --
 client/src/views/Analyze.vue       | 7 ++++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/client/src/components/BaseGame.vue b/client/src/components/BaseGame.vue
index e880de5f..41ab55dc 100644
--- a/client/src/components/BaseGame.vue
+++ b/client/src/components/BaseGame.vue
@@ -100,6 +100,12 @@ export default {
         vr_tmp.play(move);
         move.fen = vr_tmp.getFen();
       });
+      if (this.game.fenStart.indexOf(" b ") >= 0 ||
+        (this.moves.length > 0 && this.moves[0].color == "b"))
+      {
+        // 'end' is required for Board component to check lastMove for e.p.
+        this.moves.unshift({color: "w", notation: "...", end: {x:-1,y:-1}});
+      }
       const L = this.moves.length;
       this.cursor = L-1;
       this.lastMove = (L > 0 ? this.moves[L-1]  : null);
diff --git a/client/src/components/MoveList.vue b/client/src/components/MoveList.vue
index cebbff47..6e2ef66e 100644
--- a/client/src/components/MoveList.vue
+++ b/client/src/components/MoveList.vue
@@ -6,8 +6,6 @@ export default {
 	render(h) {
 		if (this.moves.length == 0)
 			return;
-		if (this.moves[0].color == "b")
-			this.moves.unshift({color: "w", notation: "..."});
 		let tableContent = [];
 		let moveCounter = 0;
 		let tableRow = undefined;
diff --git a/client/src/views/Analyze.vue b/client/src/views/Analyze.vue
index d1b669ec..cd25c254 100644
--- a/client/src/views/Analyze.vue
+++ b/client/src/views/Analyze.vue
@@ -1,6 +1,8 @@
 <template lang="pug">
 main
-  BaseGame(:game="game" :vr="vr" ref="basegame")
+  .row
+    .col-sm-12.col-md-10.col-md-offset-1
+      BaseGame(:game="game" :vr="vr" ref="basegame")
 </template>
 
 <script>
@@ -48,6 +50,9 @@ export default {
       const vModule = await import("@/variants/" + this.game.vname + ".js");
       window.V = vModule.VariantRules;
       this.vr = new V(this.game.fen);
+      // fenStart initialized in the end, after definition of V,
+      // because it triggers a reset on BaseGame component.
+      this.$set(this.game, "fenStart", this.gameRef.fen); //TODO: Vue3...
     },
   },
 };
-- 
2.44.0