fix(mobile): thumbnail requests not being cancelled (#21331)

* fix requests not being cancelled

* handle thumbhash
This commit is contained in:
Mert 2025-08-27 17:40:45 -04:00 committed by GitHub
parent ae104ad7cc
commit dc6ac3aaec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 23 deletions

View file

@ -17,11 +17,12 @@ class ThumbHashProvider extends CancellableImageProvider<ThumbHashProvider>
@override
ImageStreamCompleter loadImage(ThumbHashProvider key, ImageDecoderCallback decode) {
return OneFramePlaceholderImageStreamCompleter(_loadCodec(key, decode))..addOnLastListenerRemovedCallback(cancel);
return OneFramePlaceholderImageStreamCompleter(_loadCodec(key, decode), onDispose: cancel);
}
Stream<ImageInfo> _loadCodec(ThumbHashProvider key, ImageDecoderCallback decode) {
return loadRequest(ThumbhashImageRequest(thumbhash: key.thumbHash), decode);
final request = this.request = ThumbhashImageRequest(thumbhash: key.thumbHash);
return loadRequest(request, decode);
}
@override