diff --git a/.github/workflows/health_dashboard.yml b/.github/workflows/health_dashboard.yml index 9920871..42669f6 100644 --- a/.github/workflows/health_dashboard.yml +++ b/.github/workflows/health_dashboard.yml @@ -25,7 +25,7 @@ jobs: name: Generate & Deploy Dashboard runs-on: ubuntu-latest environment: - name: github-pages + name: ${{ github.event_name != 'pull_request' && 'github-pages' || '' }} url: ${{ steps.deployment.outputs.page_url }} steps: diff --git a/lib/ui/dashboard.dart b/lib/ui/dashboard.dart index 942db2a..a66f2ab 100644 --- a/lib/ui/dashboard.dart +++ b/lib/ui/dashboard.dart @@ -950,6 +950,7 @@ class _DashboardScreenState extends ConsumerState String selectedDestination = ''; LatLng? selectedDestinationLatLng; + int queryId = 0; await showModalBottomSheet( context: context, @@ -981,6 +982,16 @@ class _DashboardScreenState extends ConsumerState if (textEditingValue.text.length < 3) { return const Iterable<_NominatimHit>.empty(); } + + // ⚡ Bolt Optimization: Debounce Nominatim API requests to reduce network usage and comply with 1 req/sec limit. + final int currentId = ++queryId; + await Future.delayed( + const Duration(milliseconds: 1000), + ); + if (queryId != currentId) { + return const Iterable<_NominatimHit>.empty(); + } + try { final uri = Uri.parse( 'https://nominatim.openstreetmap.org/search?q=${Uri.encodeComponent(textEditingValue.text)}&format=json&addressdetails=1&limit=5',