diff --git a/src/source/source_cache.js b/src/source/source_cache.js index 757b76c02cf..679423aa16f 100644 --- a/src/source/source_cache.js +++ b/src/source/source_cache.js @@ -650,10 +650,10 @@ class SourceCache extends Evented { _updateLoadedParentTileCache() { this._loadedParentTiles = {}; - for (const tile of (Object.values(this._tiles): any)) { + for (const tileKey in this._tiles) { const path = []; let parentTile: ?Tile; - let currentId = tile.tileID; + let currentId = this._tiles[tileKey].tileID; // Find the closest loaded ancestor by traversing the tile tree towards the root and // caching results along the way @@ -678,8 +678,8 @@ class SourceCache extends Evented { } // Cache the result of this traversal to all newly visited tiles - for (let i = 0; i < path.length; i++) { - this._loadedParentTiles[path[i]] = parentTile; + for (const key of path) { + this._loadedParentTiles[key] = parentTile; } } }