X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FAnalyze.vue;h=96ecdad9081ff84712ad6bc4b70ca7b0964ba538;hp=9a6d047139f416a56619f7eb821b529293b4d129;hb=a0c41e7e23c9ff64031739e072f38e493bac8dca;hpb=8c5f5390efed4753d6ac1b7bf84dc9922dd0df7e diff --git a/client/src/views/Analyze.vue b/client/src/views/Analyze.vue index 9a6d0471..96ecdad9 100644 --- a/client/src/views/Analyze.vue +++ b/client/src/views/Analyze.vue @@ -36,33 +36,32 @@ export default { }; }, watch: { - "$route": function(to, from) { - this.gameRef.fen = to.query["fen"].replace(/_/g, " "); - this.gameRef.vname = to.params["vname"]; - this.loadGame(); - }, + // NOTE: no watcher for $route change, because if fenStart doesn't change + // then it doesn't trigger BaseGame.re_init() and the result is weird. "vr.movesCount": function(fen) { this.curFen = this.vr.getFen(); this.adjustFenSize(); }, }, created: function() { - this.gameRef.fen = this.$route.query["fen"].replace(/_/g, " "); this.gameRef.vname = this.$route.params["vname"]; - if (this.gameRef.vname != "Dark") - this.initialize(this.loadGame); - else + if (this.gameRef.vname == "Dark") { alert(this.st.tr["Analyze in Dark mode makes no sense!"]); history.back(); //or this.$router.go(-1) } + else + { + this.gameRef.fen = this.$route.query["fen"].replace(/_/g, " "); + this.initialize(); + } }, methods: { - initialize: async function(callback) { + initialize: async function() { // Obtain VariantRules object const vModule = await import("@/variants/" + this.gameRef.vname + ".js"); window.V = vModule.VariantRules; - callback(); + this.loadGame(); }, loadGame: function() { // NOTE: no need to set score (~unused)