The issue was that when initializing data to initialFeaturePredictions, the spread operator was used to create a new object, but that performs a shallow copy, so the internal data array was being reused, and appended to with the points from the new route when a new route was selected. Fixed this by changing initialFeaturePredictions object to initializeFeaturePredictions function that returns a newly created object each time.
The issue was that when initializing data to initialFeaturePredictions, the spread operator was used to create a new object, but that performs a shallow copy, so the internal data array was being reused, and appended to with the points from the new route when a new route was selected. Fixed this by changing initialFeaturePredictions object to initializeFeaturePredictions function that returns a newly created object each time.