X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FProblems.vue;h=3b53a1a0c7ed05da7cd2e526ae216ce17f969a9c;hp=71f5c3e0f6e6d439076cff820e9e6c4b48741358;hb=b1e46b33d78bdf144a5603f82a6907901763abb9;hpb=4db4c67c0ce025d2f9f151d70e81128a3b26b5c5 diff --git a/client/src/views/Problems.vue b/client/src/views/Problems.vue index 71f5c3e0..3b53a1a0 100644 --- a/client/src/views/Problems.vue +++ b/client/src/views/Problems.vue @@ -97,6 +97,7 @@ main td {{ firstChars(p.instruction) }} td {{ p.id }} BaseGame( + ref="basegame" v-if="showOne" :game="game" ) @@ -162,7 +163,7 @@ export default { }); const showOneIfPid = () => { const pid = this.$route.query["id"]; - if (pid) this.showProblem(this.problems.find(p => p.id == pid)); + if (!!pid) this.showProblem(this.problems.find(p => p.id == pid)); }; if (Object.keys(names).length > 0) { ajax( @@ -200,7 +201,7 @@ export default { }, $route: function(to) { const pid = to.query["id"]; - if (pid) this.showProblem(this.problems.find(p => p.id == pid)); + if (!!pid) this.showProblem(this.problems.find(p => p.id == pid)); else this.showOne = false; } }, @@ -298,10 +299,13 @@ export default { // The FEN is already checked at this stage: this.game.vname = p.vname; this.game.mycolor = V.ParseFen(p.fen).turn; //diagram orientation + this.game.fenStart = p.fen; this.game.fen = p.fen; - this.$set(this.game, "fenStart", p.fen); - this.copyProblem(p, this.curproblem); this.showOne = true; + // $nextTick to be sure $refs["basegame"] exists + this.$nextTick(() => { + this.$refs["basegame"].re_setVariables(this.game); }); + this.copyProblem(p, this.curproblem); }); }, gotoPrevNext: function(e, prob, dir) {