@@ -354,6 +354,7 @@ class MapboxRouteLineView @VisibleForTesting internal constructor(
354354 }
355355 val featureQueue = ArrayDeque (featuresNotOnMap)
356356
357+ val sourceFeaturePairingsMap = sourceToFeatureMap.toMutableMap()
357358 val expectedRoutesData = ExpectedRoutesToRenderData ()
358359 sourcesToUpdate.forEach { sourceToUpdate ->
359360 val nextFeatureId = featureQueue.removeFirstOrNull()
@@ -375,8 +376,9 @@ class MapboxRouteLineView @VisibleForTesting internal constructor(
375376 expectedRoutesData.addRenderedRoute(sourceId, dataId, routeId)
376377 updateSourceCommands.add {
377378 updateSource(style, sourceToUpdate.key.sourceId, fc, dataId)
379+ sourceToFeatureMap[sourceToUpdate.key] = RouteLineFeatureId (routeId)
378380 }
379- sourceToFeatureMap [sourceToUpdate.key] = RouteLineFeatureId (routeId)
381+ sourceFeaturePairingsMap [sourceToUpdate.key] = RouteLineFeatureId (routeId)
380382 }
381383 if (callback != null ) {
382384 routesExpector.expectRoutes(
@@ -387,7 +389,7 @@ class MapboxRouteLineView @VisibleForTesting internal constructor(
387389 )
388390 }
389391
390- val sourceFeaturePairings = sourceToFeatureMap .toMutableList()
392+ val sourceFeaturePairings = sourceFeaturePairingsMap .toMutableList()
391393 routeLineDatas.forEachIndexed { index, routeLineData ->
392394 val relatedSourceKey = getRelatedSourceKey(
393395 routeLineData.featureCollection.features()?.firstOrNull()?.id(),
0 commit comments