From 0f21a92a8420594e8224318d3c6b758f6a3876f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 31 Jan 2023 16:26:45 +0100 Subject: [PATCH] Implement 'isPreparedForMarkers' and set a watcher, because sometimes the current users pin is missing --- webapp/pages/map.vue | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/webapp/pages/map.vue b/webapp/pages/map.vue index 8f6dca457..f7b3efe18 100644 --- a/webapp/pages/map.vue +++ b/webapp/pages/map.vue @@ -117,6 +117,15 @@ export default { ...mapGetters({ currentUser: 'auth/user', }), + isPreparedForMarkers() { + return ( + !this.markers.isGeoJSON && + this.markers.isImagesLoaded && + this.currentUser && + this.users && + this.groups + ) + }, styles() { return objectValuesToArray(this.availableStyles) }, @@ -160,6 +169,13 @@ export default { return this.currentUserCoordinates ? 10 : 4 }, }, + watch: { + isPreparedForMarkers(newValue) { + if (newValue) { + this.addMarkersOnCheckPrepared() + } + }, + }, methods: { onMapLoad({ map }) { this.map = map @@ -293,13 +309,7 @@ export default { }, addMarkersOnCheckPrepared() { // set geoJSON for markers - if ( - !this.markers.isGeoJSON && - this.markers.isImagesLoaded && - this.currentUser && - this.users && - this.groups - ) { + if (this.isPreparedForMarkers) { // add markers for "users" this.users.forEach((user) => { if (user.id !== this.currentUser.id && user.location) {