Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 9e88b17

Browse files
committed
Fix permanent property ignored
1 parent 86b0113 commit 9e88b17

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ const imageCacheHoc = <P extends object>(
243243

244244
// Set url from source prop
245245
const url = traverse(this.props).get(['source', 'uri'])
246+
const permanent = this.props.permanent ? true : false
246247

247248
// Add a cache lock to file with this name (prevents concurrent <CacheableImage> components from pruning a file with this name from cache).
248249
const fileName = this.fileSystem.getFileNameFromUrl(url)
@@ -251,7 +252,7 @@ const imageCacheHoc = <P extends object>(
251252
// Init the image cache logic
252253
if (!this.invalidUrl) {
253254
this.subscription = this.fileSystem
254-
.observable(url, this.componentId)
255+
.observable(url, this.componentId, permanent)
255256
.pipe(takeUntil(this.unmounted$.pipe(skip(1))))
256257
.subscribe((info) => this.onSourceLoaded(info))
257258
}
@@ -280,12 +281,13 @@ const imageCacheHoc = <P extends object>(
280281
FileSystem.lockCacheFile(nextFileName, this.componentId)
281282

282283
this.invalidUrl = !this._validateImageComponent()
284+
const permanent = this.props.permanent ? true : false
283285

284286
// Init the image cache logic
285287
this.subscription?.unsubscribe()
286288
if (!this.invalidUrl) {
287289
this.subscription = this.fileSystem
288-
.observable(nextUrl, this.componentId)
290+
.observable(nextUrl, this.componentId, permanent)
289291
.pipe(takeUntil(this.unmounted$.pipe(skip(1))))
290292
.subscribe((info) => this.onSourceLoaded(info))
291293
}

0 commit comments

Comments
 (0)