Skip to content

ROU-12127: Fix Leaflet directions throwing when removed while a route is calculated - #278

Merged
gnbm merged 6 commits into
devfrom
ROU-12127
Oct 26, 2026
Merged

gnbm merged 6 commits into
devfrom
ROU-12127

Conversation

@gnbm

@gnbm gnbm commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

This PR is for fixing the Leaflet Directions exception when a route is removed or replaced while it is still being calculated.

What was happening

  • Adding waypoints or pressing GO before the previous route was drawn threw Cannot read properties of null (reading 'removeLayer') in leaflet-routing-machine: the control was removed from the map while its route request was still running.
  • Each SetDirections on an existing route made 3 routing requests, and routing failures were ignored, leaving GetTotalDistance/GetTotalDuration waiting forever.

What was done

  • Cancel the pending route request before removing the routing control (no changes to the external library).
  • One routing request per SetDirections.
  • Routing failures raise the Map OnError event once (MAPS-LIB-04001); GetTotalDistance/GetTotalDuration always resolve.
  • ADR-0007 documents the changes; ADRs moved to docs-internal/adr and .gitignore aligned with outsystems-ui.

Test Steps

  1. Open the sample page and click GO several times quickly (or click on the map to add waypoints before the route is drawn).
  2. Click GO and then Remove Directions right away.
  3. Confirm there are no errors in the console and the last route is drawn.

Screenshots

N/A

Checklist

  • tested locally
  • documented the code
  • clean all warnings and errors of eslint
  • requires changes in OutSystems (if so, provide a module with changes)
  • requires new sample page in OutSystems (if so, provide a module with changes)

gnbm added 3 commits October 25, 2026 14:55
… is calculated

- Cancel the pending route request before removing the routing control
- Make a single routing request per SetDirections
- Raise the Map OnError event once when routing fails (MAPS-LIB-04001)
- Never leave GetTotalDistance/GetTotalDuration waiting
…utsystems-ui

docs/ only holds generated TypeDoc output, so ADRs no longer need to be force-added.
@gnbm gnbm added the bug Something isn't working label Oct 25, 2026
@gnbm gnbm changed the title ROU-12127 Fix Leaflet directions throwing when removed while a route is calculated ROU-12127: Fix Leaflet directions throwing when removed while a route is calculated Oct 25, 2026
gnbm added 3 commits October 25, 2026 15:05
… not awaited

cleanOldFiles did not return its stream, so gulp moved on immediately and the
deletion ran after the synchronous TypeScript emit, removing the freshly built
files whenever dist already existed. Return the stream (aligned with
outsystems-ui) so the clean finishes before the build writes into dist.
@sonarqubecloud

Copy link
Copy Markdown

@gnbm
gnbm marked this pull request as ready for review October 25, 2026 22:55
@gnbm
gnbm requested a review from a team as a code owner October 25, 2026 22:55
@os-davidlourenco
os-davidlourenco requested a balanced review from Copilot October 26, 2026 11:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@gnbm
gnbm merged commit 4dab82e into dev Oct 26, 2026
16 of 17 checks passed
@gnbm
gnbm deleted the ROU-12127 branch October 26, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants