Route editor: stale track on anchor removal + undo removes all points #16
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while click-testing the smart-insertion build; all fixed on
feat/smart-insertion(commit5e20f773, deployed). Root causes confirmed by static trace of the render pipeline.Bugs
removeAnchor'sanchorIndex==0branch gated the map refresh behind$formData.expand.gpx_data(always undefined while drawing a new trail) → no refresh.anchorsBefore/anchorsAfter, soundoRouteEditrebuilt anchors from the emptied route.deleteFromRoutecomputed totals from the pre-delete route (valhallaStore.route.getTotals()) → stale distance/elevation.Fixes
removeAnchor: clear the track when<2anchors remain (mirrorsrecalculateRouteFromAnchors'sN<2path); drop thegpx_datagate; rebuild viasetRoutewhen removing the end anchor.tagLastRouteUndo(...)and tag append/prepend/mid-insert actions so undo/redo restore the anchor list.insertAnchorSplit()store fn so a mid-route insert is one undo entry.deleteFromRoute: totals from the reduced snapshot.Noted latent issue (not fixed):
valhallaStore.route = applyChangeset(route, delta)is a Svelte$stateno-op —applyChangesetmutates in place and returns the same reference, so any future$effect/$derivedreadingroutedirectly won't react. Consumers currently go through freshmapTrail/routeSegmentsliterals so it's latent. Worth a separate fix.Upstream: these are pre-existing upstream bugs — split into atomic PRs when upstreaming (separate from the smart-insertion feature PR).
Fixed earlier this session (
5e20f773/597185c4): removeAnchor clears the track + rebuilds endpoints, undo no longer removes all points, marker/undo sync, first-anchor undoable. Live. Closing.