mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 08:30:05 +00:00
fix(maps): marker thumbs from cached place photos load under the same request limit
A place whose image_url already is the place-photo proxy URL skipped the five slot limiter and loaded its marker picture right away. A map showing a big list, such as "All saved" in collections, asked for every picture at once. Those downloads now wait for a slot like the provider lookups do; the entry itself is still there immediately. Refs #2559
This commit is contained in:
@@ -114,10 +114,15 @@ export function fetchPhoto(
|
||||
cache.set(cacheKey, entry)
|
||||
callback?.(entry)
|
||||
notify(cacheKey, entry)
|
||||
// Generate base64 thumb in background
|
||||
void urlToBase64(photoId).then(thumb => {
|
||||
if (thumb) { entry.thumbDataUrl = thumb; notifyThumb(cacheKey, thumb) }
|
||||
})
|
||||
// Generate base64 thumb in background, under the same limit as the API path:
|
||||
// a list of a thousand saved places would otherwise ask for a thousand
|
||||
// pictures at once (#2559).
|
||||
void acquireRequestSlot()
|
||||
.then(() => urlToBase64(photoId))
|
||||
.then(thumb => {
|
||||
if (thumb) { entry.thumbDataUrl = thumb; notifyThumb(cacheKey, thumb) }
|
||||
})
|
||||
.finally(releaseRequestSlot)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user