Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/health_dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 11 additions & 0 deletions lib/ui/dashboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen>

String selectedDestination = '';
LatLng? selectedDestinationLatLng;
int queryId = 0;

await showModalBottomSheet<void>(
context: context,
Expand Down Expand Up @@ -981,6 +982,16 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen>
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<void>.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',
Expand Down
Loading