Skip to content

Commit e485069

Browse files
jushgithub-actions[bot]
authored andcommitted
Update cached feature sources only when update source command has run
GitOrigin-RevId: 4f2ab2198958cbffca3b5c5a78113b508a7e7550
1 parent d60a4fe commit e485069

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

ui-maps/src/main/java/com/mapbox/navigation/ui/maps/route/line/api/MapboxRouteLineView.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)