From d2524402041e8efb24b6980d2f0071846f2e25a8 Mon Sep 17 00:00:00 2001 From: 4aiman Date: Sun, 16 Aug 2026 21:06:50 +0300 Subject: [PATCH] Fix: single-point track hung showSessionDetail (Delete did nothing) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.) --- frontend/js/main.js | 6 ++++++ src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/js/main.js b/frontend/js/main.js index a29f4e3..bc6dfcc 100644 --- a/frontend/js/main.js +++ b/frontend/js/main.js @@ -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; diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index f357256..b0dd34d 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -139,7 +139,7 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "baldav" -version = "0.1.408" +version = "0.1.409" dependencies = [ "base64 0.22.1", "btleplug", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 2dd8e04..9bc4bf6 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "baldav" -version = "0.1.408" +version = "0.1.409" edition = "2021" [lib] diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 3e3d691..337208e 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -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"