Skip to content

Commit

Permalink
Merge pull request #157 from Carifio24/two-many-locations
Browse files Browse the repository at this point in the history
Reduce number of MapBox requests
  • Loading branch information
patudom authored Apr 5, 2024
2 parents da4e44d + ae499d4 commit 6d71cb5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/AdvancedWeatherView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1230,10 +1230,17 @@ export default defineComponent({
this.firstOpen = false;
// this.displayData = false;
}
if (value && (this.defaultLocation.latitudeDeg !== this.location.latitudeDeg || this.defaultLocation.longitudeDeg !== this.location.longitudeDeg)) {
this.location = this.defaultLocation;
}
},
defaultLocation(value: CityLocation) {
console.log('defaultLocation', value);
if (!this.modelValue) {
return;
}
// check if they are the same, if so do nothing
if (value.latitudeDeg === this.location.latitudeDeg && value.longitudeDeg === this.location.longitudeDeg) {
return;
Expand Down Expand Up @@ -1273,10 +1280,12 @@ export default defineComponent({
},
location(value: CityLocation, old: CityLocation) {
console.log('location', value);
if (value.latitudeDeg === old.latitudeDeg && value.longitudeDeg === old.longitudeDeg) {
return;
}
if (!this.modelValue) {
return;
}
if (
value.latitudeDeg !== this.defaultLocation.latitudeDeg
||
Expand Down
4 changes: 3 additions & 1 deletion src/SolarEclipse2024.vue
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,9 @@
};
locationDeg = myLocation;
showMyLocationDialog = false;
updateSelectedLocationText();
if (myLocation.latitudeDeg !== locationDeg.latitudeDeg || myLocation.longitudeDeg !== locationDeg.longitudeDeg) {
updateSelectedLocationText();
}
}"
@error="(error: GeolocationPositionError) => {
$notify({
Expand Down

0 comments on commit 6d71cb5

Please sign in to comment.