Skip to content

Commit

Permalink
Order cacheKey components consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Dec 20, 2017
1 parent 2e6fc89 commit 0aed52e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/data/program_configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ class ProgramConfiguration {

static createDynamic<Layer: TypedStyleLayer>(layer: Layer, zoom: number, filterProperties: (string) => boolean) {
const self = new ProgramConfiguration();
const keys = [];

for (const property in layer.paint._values) {
if (!filterProperties(property)) continue;
const value = layer.paint.get(property);
Expand All @@ -299,16 +301,18 @@ class ProgramConfiguration {

if (value.value.kind === 'constant') {
self.binders[property] = new ConstantBinder(value.value, name, type);
self.cacheKey += `/u_${name}`;
keys.push(`/u_${name}`);
} else if (value.value.kind === 'source') {
self.binders[property] = new SourceExpressionBinder(value.value, name, type);
self.cacheKey += `/a_${name}`;
keys.push(`/a_${name}`);
} else {
self.binders[property] = new CompositeExpressionBinder(value.value, name, type, useIntegerZoom, zoom);
self.cacheKey += `/z_${name}`;
keys.push(`/z_${name}`);
}
}

self.cacheKey = keys.sort().join('');

return self;
}

Expand Down

0 comments on commit 0aed52e

Please sign in to comment.