Fix: single-point track hung showSessionDetail (Delete did nothing)

Diagnosed live over the WebView DevTools protocol: a 0 km track had exactly one
usable point. The map block runs (points.length is truthy), but with a single
coordinate fitBounds is skipped, so the Leaflet map never gets a view and never
fires 'load'. With a saved route active, the overlay code then does
`await whenMapReady(map)`, which waits on that 'load' event forever — hanging the
rest of showSessionDetail, so the Delete/Recalc/Export handlers past it never
bind. No exception, just a silent stall (hence "nothing happens on Delete").

Fix: when there are < 2 coords, setView to the single point so the map loads and
whenMapReady resolves. Verified end-to-end via DevTools: the button now binds and
the 0 km track deletes.

(The prior commit moved the handlers out of the `points.length` guard, which
covers a truly 0-point track; this covers the 1-point-with-route hang.)
This commit is contained in:
4aiman 2026-08-16 21:06:50 +03:00
commit d252440204
4 changed files with 9 additions and 3 deletions

View file

@ -4563,6 +4563,12 @@ async function showSessionDetail(sessionId) {
map.invalidateSize();
if (allCoords.length > 1) {
map.fitBounds(L.latLngBounds(allCoords).pad(0.1));
} else if (points.length) {
// Degenerate track (a single usable point): fitBounds needs 2+ coords, so
// give the map a view explicitly — otherwise it never fires 'load' and the
// route-overlay `await whenMapReady(map)` below hangs forever, blocking the
// rest of showSessionDetail (including the Delete button binding).
map.setView([points[0].lat, points[0].lon], 15);
}
mapEl._bounds = allCoords.length > 1 ? L.latLngBounds(allCoords).pad(0.1) : null;

2
src-tauri/Cargo.lock generated
View file

@ -139,7 +139,7 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "baldav"
version = "0.1.408"
version = "0.1.409"
dependencies = [
"base64 0.22.1",
"btleplug",

View file

@ -1,6 +1,6 @@
[package]
name = "baldav"
version = "0.1.408"
version = "0.1.409"
edition = "2021"
[lib]

View file

@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/nicegui/tauri-v2/refs/heads/main/tooling/cli/schema.json",
"productName": "BalDav",
"version": "0.1.408",
"version": "0.1.409",
"identifier": "dev.baldav.app",
"build": {
"frontendDist": "../frontend"