Repository navigation
Fix welcome images not reloading when the URL changes mid-download #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ import com.adobe.marketing.mobile.services.Log | |
| import com.adobe.marketing.mobile.services.NetworkCallback | ||
| import com.adobe.marketing.mobile.services.NetworkRequest | ||
| import com.adobe.marketing.mobile.services.ServiceProvider | ||
| import kotlinx.coroutines.CancellationException | ||
| import kotlinx.coroutines.Dispatchers | ||
| import kotlinx.coroutines.suspendCancellableCoroutine | ||
| import kotlinx.coroutines.withContext | ||
|
|
@@ -122,6 +123,9 @@ internal class DefaultImageProvider( | |
| connection.close() | ||
|
|
||
| bitmap ?: throw IOException("Failed to decode image from URL: $url") | ||
| } catch (e: CancellationException) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [LOW] Inside The |
||
| // Normal coroutine cancellation; rethrow so it is not misreported as a load error. | ||
| throw e | ||
| } catch (e: IOException) { | ||
| Log.error( | ||
| ConciergeConstants.EXTENSION_NAME, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[HIGH] This comment says the state holder is keyed on
url, but the code doesn't do that.produceState(initialValue, key1 = url)keeps its state in an unkeyedremember { mutableStateOf(initialValue) };key1only restarts the producer (LaunchedEffect). On a URL change, the previous value is kept and thevalue.state == ImageLoadingState.Loadingguard below skips loading the new URL whenever the old URL had already:The rethrows only fix the in-flight case. Suggest actually resetting the state per URL, e.g.: