Skip to content

Commit

Permalink
fix: race condition between mode switching #496
Browse files Browse the repository at this point in the history
  • Loading branch information
wazolab authored and frodrigo committed Feb 27, 2025
1 parent d86964a commit 826b3c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions components/Home/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,11 @@ function onBottomMenuButtonClick() {
isMenuItemOpen.value = !isMenuItemOpen.value
}
function onQuitExplorerFavoriteMode() {
async function onQuitExplorerFavoriteMode() {
if (mapFeaturesRef.value)
await mapFeaturesRef.value.updateSelectedFeature()
mode.value = Mode.BROWSER
mapStore.setSelectedFeature()
}
function toggleFavoriteMode() {
Expand Down Expand Up @@ -581,7 +583,7 @@ function handlePoiCardClose() {
:small="isBottomMenuOpened"
:categories="apiMenuCategory || []"
:features="mapFeatures"
:selected-categories-ids="isModeExplorer ? [] : selectedCategoryIds"
:selected-categories-ids="selectedCategoryIds"
:style-icon-filter="poiFilters"
:enable-filter-route-by-categories="!isModeFavorites"
:enable-filter-route-by-features="isModeFavorites"
Expand Down
4 changes: 2 additions & 2 deletions components/MainMap/MapFeatures.vue
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ function onClick(e: MapMouseEvent): void {
async function updateSelectedFeature(feature?: ApiPoi): Promise<void> {
if (!feature) {
mapStore.setSelectedFeature()
menuStore.fetchFeatures({
await menuStore.fetchFeatures({
vidoConfig: config!,
categoryIds: props.selectedCategoriesIds,
clipingPolygonSlug: route.query.clipingPolygonSlug?.toString(),
})
mapStore.setSelectedFeature()
}
else {
const id = feature.properties.metadata.id || feature.properties.id || feature.id
Expand Down

0 comments on commit 826b3c0

Please sign in to comment.