diff --git a/lib/modules/asset_tracking/map_tracking_page.dart b/lib/modules/asset_tracking/map_tracking_page.dart index d3690be8..5f8dcdab 100644 --- a/lib/modules/asset_tracking/map_tracking_page.dart +++ b/lib/modules/asset_tracking/map_tracking_page.dart @@ -141,10 +141,13 @@ class _MapTrackingPageState extends State { _lastFittedCoordinatesKey = null; // force re-fit even if the same building is viewed again }); - Utils.showLoading(context); + // Only show the loader when zones must be fetched; if they are cached the call completes + // before the (post-frame) dialog appears, and the dialog would never be dismissed. + final needsNetwork = provider.zonesList.isEmpty; + if (needsNetwork) Utils.showLoading(context); await provider.getZoneFromPenguin(); if (!mounted) return; - Utils.hideLoading(context); + if (needsNetwork) Utils.hideLoading(context); // Camera fit happens in the building-outline Selector once the polygon is rendered. } @@ -621,6 +624,8 @@ class _MapTrackingPageState extends State { onSelect: (value) { if (value != null) { assetProvider.selectedSite = value; + assetProvider.selectedBuilding = null; + assetProvider.selectedFloor = null; getPenguinBuildings(value.id!); } },