Skip to content

Commit

Permalink
paths: update layers when TransitPathEdit component is mounted
Browse files Browse the repository at this point in the history
fixes #1178

The upgrade to React 19 seemingly changed the handling of events in such
a way that the path selection event is now handled before the
`TransitPathEdit` component is mounted, while it was handled after in
the React 16 version. So we call the `updateLayers` method at mount to
display the selected path.
  • Loading branch information
tahini committed Jan 9, 2025
1 parent f1b0d6e commit f7f3de2
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ class TransitPathEdit extends SaveableObjectForm<Path, PathFormProps, PathFormSt
serviceLocator.eventManager.on('waypoint.update', this.onUpdateWaypoint);
serviceLocator.eventManager.on('waypoint.replaceByNodeId', this.onReplaceWaypointByNodeId);
serviceLocator.eventManager.on('selected.updateLayers.path', this.updateLayers);
// Call the updateLayers method to display the path on the map, as the event may have been emitted before the listener was added
this.updateLayers();
serviceLocator.keyboardManager.on('m', this.toggleTemporaryManualRouting);
}

Expand Down

0 comments on commit f7f3de2

Please sign in to comment.