Skip to content

Commit

Permalink
refactor(cacheStyle): simplified key
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed Oct 24, 2024
1 parent 4f9c0c9 commit f5e0a65
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Core/Style.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ function readVectorProperty(property, options) {
}
}

async function loadImage(source) {
let promise = cacheStyle.get(source, 'null');
async function loadImage(url) {
const source = url.split('?')[0];
let promise = cacheStyle.get(source);
if (!promise) {
promise = Fetcher.texture(source, { crossOrigin: 'anonymous' });
cacheStyle.set(promise, source, 'null');
promise = Fetcher.texture(url, { crossOrigin: 'anonymous' });
cacheStyle.set(promise, source);
}
return (await promise).image;
}
Expand Down

0 comments on commit f5e0a65

Please sign in to comment.