# HG changeset patch # User Markus Kottlaender # Date 1540455750 -7200 # Node ID f8a4ec146d476082bb1004fa2a73c1721d906703 # Parent 740679d6682f1afeb516db384417ebe81fcaf1cc fixed Vue reactivity issue (splitscreen button) diff -r 740679d6682f -r f8a4ec146d47 client/src/application/Topbar.vue --- a/client/src/application/Topbar.vue Thu Oct 25 08:05:06 2018 +0200 +++ b/client/src/application/Topbar.vue Thu Oct 25 10:22:30 2018 +0200 @@ -18,7 +18,7 @@ -
+
@@ -236,7 +236,7 @@ this.$store.commit("application/toggleSidebar"); }, splitScreen() { - if (this.currentProfile.length == 0) return; + if (Object.keys(this.currentProfile).length == 0) return; this.$store.commit("application/toggleSplitScreen"); } } diff -r 740679d6682f -r f8a4ec146d47 client/src/fairway/store.js --- a/client/src/fairway/store.js Thu Oct 25 08:05:06 2018 +0200 +++ b/client/src/fairway/store.js Thu Oct 25 10:22:30 2018 +0200 @@ -11,7 +11,9 @@ * * Author(s): * Thomas Junk + * Markus Kottländer */ +import Vue from "vue"; import { HTTP } from "../application/lib/http"; import { prepareProfile } from "../application/lib/geo"; import LineString from "ol/geom/LineString.js"; @@ -58,7 +60,9 @@ const endPoint = state.endPoint; const geoJSON = data; const result = prepareProfile({ geoJSON, startPoint, endPoint }); - state.currentProfile[surveyDate] = result.points; + // Use Vue.set() to make new object properties rective + // https://vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats + Vue.set(state.currentProfile, surveyDate, result.points); state.minAlt = result.minAlt; state.maxAlt = result.maxAlt; state.totalLength = result.lengthPolyLine;