Fix: fix #2254; an image carousel with a different key would not show up due to caching
This commit is contained in:
parent
90a2fd4713
commit
c0b11a81e9
1 changed files with 6 additions and 4 deletions
|
@ -68,7 +68,7 @@ export default class AllImageProviders {
|
||||||
|
|
||||||
private static readonly _cachedImageStores: Record<string, Store<ProvidedImage[]>> = {}
|
private static readonly _cachedImageStores: Record<string, Store<ProvidedImage[]>> = {}
|
||||||
/**
|
/**
|
||||||
* Tries to extract all image data for this image. Cachedon tags?.data?.id
|
* Tries to extract all image data for this image. Cached on tags?.data?.id
|
||||||
*/
|
*/
|
||||||
public static LoadImagesFor(
|
public static LoadImagesFor(
|
||||||
tags: Store<Record<string, string>>,
|
tags: Store<Record<string, string>>,
|
||||||
|
@ -78,8 +78,9 @@ export default class AllImageProviders {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
const id = tags?.data?.id
|
const id = tags?.data?.id
|
||||||
if (this._cachedImageStores[id]) {
|
const cachekey = id + (tagKey?.join(";") ?? "")
|
||||||
return this._cachedImageStores[id]
|
if (this._cachedImageStores[cachekey]) {
|
||||||
|
return this._cachedImageStores[cachekey]
|
||||||
}
|
}
|
||||||
|
|
||||||
const source = new UIEventSource([])
|
const source = new UIEventSource([])
|
||||||
|
@ -90,6 +91,7 @@ export default class AllImageProviders {
|
||||||
However, we override them if a custom image tag is set, e.g. 'image:menu'
|
However, we override them if a custom image tag is set, e.g. 'image:menu'
|
||||||
*/
|
*/
|
||||||
const prefixes = tagKey ?? imageProvider.defaultKeyPrefixes
|
const prefixes = tagKey ?? imageProvider.defaultKeyPrefixes
|
||||||
|
console.log("Prefixes are", tagKey, prefixes)
|
||||||
const singleSource = tags.bindD((tags) => imageProvider.getRelevantUrls(tags, prefixes))
|
const singleSource = tags.bindD((tags) => imageProvider.getRelevantUrls(tags, prefixes))
|
||||||
allSources.push(singleSource)
|
allSources.push(singleSource)
|
||||||
singleSource.addCallbackAndRunD((_) => {
|
singleSource.addCallbackAndRunD((_) => {
|
||||||
|
@ -98,7 +100,7 @@ export default class AllImageProviders {
|
||||||
source.set(dedup)
|
source.set(dedup)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
this._cachedImageStores[id] = source
|
this._cachedImageStores[cachekey] = source
|
||||||
return source
|
return source
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue