Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use provided transition on cache hit #12

Closed
wants to merge 1 commit into from
Closed

Use provided transition on cache hit #12

wants to merge 1 commit into from

Conversation

PhilipTrauner
Copy link

@PhilipTrauner PhilipTrauner commented Mar 4, 2022

When provided with an URL that ends up being redirected (301), no cache hit occurs during initialization, as URLCache.cachedResponse expects the redirected URL to be provided instead.
This leads to _phase being set to .empty, even though the ensuing .load call will result in a cache hit, because URLSession.data does behave properly.

... that's my theory, at least 馃槵

I saw, that f24cfe7 did away with animating on cache hit.
What was the reason for that change?

When provided with an URL that ends up being redirected (301), no cache hit occurs during initialization, as `URLCache.cachedResponse` expects the redirected URL to be provided instead.
This leads to `_phase` being set to `.empty`, even though the ensuing `.load` call will result in a cache hit, because `URLSession.data` does behave properly.
@lorenzofiamingo
Copy link
Owner

lorenzofiamingo commented Mar 8, 2022

Transaction has to be used when phase changes (also according to official docs).
On cache hit phase should just be initialized to success(Image), ideally. But for some reasons this is not happening (see this). Know I try to rewrite the code avoiding URLCache.cachedResponse usage.

Copy link
Owner

@lorenzofiamingo lorenzofiamingo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'REQUEST_CHANGES' performed by Xcode.

@lorenzofiamingo
Copy link
Owner

lorenzofiamingo commented Mar 9, 2022

2977899 fix redirected urls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants