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

fix(cache): remove entry from _pending in case of exception #1048

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IgorKhramtsov
Copy link

@IgorKhramtsov IgorKhramtsov commented Mar 20, 2024

Issue

If an exception is thrown during loader execution - future with error result will be stuck in the _pending map and it will be returned every time putIfAbsent is called. There is no way to evict it either, since evict method only affects _cache map.
The exception in loader may be thrown in case of network error when SvgNetworkLoader is used.

Change

This change adds a catchError handler to remove future from the _pending map in case of failure. Also a regression test is added that will fail without this fix.

@IgorKhramtsov IgorKhramtsov changed the title fix(cache): clear _pending in case of exception fix(cache): remove entry from _pending in case of exception Mar 20, 2024
@zanderso
Copy link
Contributor

zanderso commented Nov 1, 2024

Hi there, The Flutter team is now maintaining this package in the flutter/packages repository at this location. We'd appreciate it if you could direct this PR to that location instead. Thanks!

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.

2 participants