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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update model on failed request update. #2293

Merged
merged 1 commit into from
Aug 30, 2017
Merged

Conversation

Tolriq
Copy link
Contributor

@Tolriq Tolriq commented Aug 26, 2017

Description

Ensure that restarted request use the updated model when failed/cancelled as it can contains data to help the request to succeed.

Motivation and Context

Mostly fixes #2270

Since I had to push a beta for my app to fix some unseen Android O issues and wanted to start to get feedback about Glide 4, I went with this temporary solution to have all working. I know you have not made any decisions yet, but I PR this as is to have a reference since it's now distributed to end users.

@@ -359,11 +359,12 @@ protected RequestOptions getMutableOptions() {
Request request = buildRequest(target);

Request previous = target.getRequest();
if (request.isEquivalentTo(previous)) {
if (request.isEquivalentTo(previous)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a comment that references #2270 as to why this is necessary.

@sjudd
Copy link
Collaborator

sjudd commented Aug 29, 2017

I'm willing to merge this. It's something that might go away in the future if it becomes burdensome, but I can't think of anything that would conflict with this behavior right now at least.

We should probably also try to follow up on the flashing when you manually clear() and restart requests separately. Maybe there's something else we can do to mitigate that case as well.

…led as it can contains data to help the request to succeed.
@Tolriq
Copy link
Contributor Author

Tolriq commented Aug 29, 2017

Comment added.

To be honest fixing the flashing with clear would be cool as certainly can fix other things, but having devs to always call clear when their model have private fields that can't be exposed due to hashCode() seems way more hackish than this :(

Maybe another way would be to have an optional interface on the model to test for equity and call it if the model have it instead of equals for the request restart.
Kinda the same reasoning for your usage of isEquivalentTo and not equals. And have your isEquivalentTo call that one when available.

Edit: Actually last proposal sounds good, but will require the flashing fix to have everything working as currently :( As even successful requests would be restarted on completed if internal state changes.

@sjudd
Copy link
Collaborator

sjudd commented Aug 30, 2017

Great thanks!

Can you file an issue with some details on your views that might help me track down why the flashing is occurring for your use case when you do clear? Is it in a RecyclerView? If so, are the views dimensions variable?

An optional interface is definitely worth more thought. Let's try to at least understand the flashing a bit better and go from there.

@sjudd sjudd merged commit 0a44cf6 into bumptech:master Aug 30, 2017
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.

Follow up of: https://github.com/bumptech/glide/pull/2261
2 participants