don't cache fetch failures for media
This commit is contained in:
parent
0193811993
commit
ad402ff456
1 changed files with 15 additions and 10 deletions
|
|
@ -20,6 +20,7 @@ class MxcImage(final WidgetRef ref, final DownloadMediaRequest request)
|
|||
MultiFrameImageStreamCompleter(codec: _loadAsync(decode), scale: 1.0);
|
||||
|
||||
Future<ui.Codec> _loadAsync(ImageDecoderCallback decode) async {
|
||||
try {
|
||||
final file = await ref
|
||||
.read(ClientController.provider.notifier)
|
||||
.downloadMedia(request);
|
||||
|
|
@ -31,7 +32,11 @@ class MxcImage(final WidgetRef ref, final DownloadMediaRequest request)
|
|||
return AvifCodec(await Isolate.run(() => decodeAvif(bytes)));
|
||||
}
|
||||
|
||||
return decode(await .fromUint8List(bytes));
|
||||
return await decode(await .fromUint8List(bytes));
|
||||
} catch (_) {
|
||||
scheduleMicrotask(() => PaintingBinding.instance.imageCache.evict(this));
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
Loading…
Reference in a new issue