Implement 'isPreparedForMarkers' and set a watcher, because sometimes the current users pin is missing

This commit is contained in:
Wolfgang Huß 2023-01-31 16:26:45 +01:00
parent 81f2840a95
commit 0f21a92a84

View File

@ -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) {