Skip to content

[google_fonts] Remove failed loads from pendingFonts - #12240

Merged
auto-submit[bot] merged 1 commit into
flutter:mainfrom
Yusufihsangorgel:fix/google-fonts-pending-load-cleanup
Jul 31, 2026
Merged

[google_fonts] Remove failed loads from pendingFonts#12240
auto-submit[bot] merged 1 commit into
flutter:mainfrom
Yusufihsangorgel:fix/google-fonts-pending-load-cleanup

Conversation

@Yusufihsangorgel

Copy link
Copy Markdown
Contributor

Failed font loads remain in pendingFontFutures because the current cleanup
callback runs only after successful completion. As a result, every later
GoogleFonts.pendingFonts() call rethrows the same completed error.

This change removes a tracked load on either completion path while preserving
the original error for the caller currently awaiting pendingFonts(). It adds
regression coverage showing that the first call reports the load failure and a
later call is no longer poisoned by it.

Fixesflutter/flutter#182430.

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

@github-actionsgithub-actionsBot added p: google_fonts triage-framework Should be looked at in framework triage labels Jul 18, 2026

@gemini-code-assistgemini-code-assistBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the google_fonts package to version 8.2.1. It ensures that failed font loads are removed from pendingFontFutures by replacing then with whenComplete on the loading future in google_fonts_base.dart. A unit test has been added to verify that pendingFonts correctly removes failed font loads. There are no review comments, and I have no feedback to provide.

@mafreud

Copy link
Copy Markdown

@Yusufihsangorgel Is this PR going to fix this issue?
material-foundation/flutter-packages#534

@guidezplguidezpl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

 _ ___ _____ __ __ | | / __|_ _| \/ |
| |_| (_ | | | | |\/| |
|____\___| |_| |_| |_|

@Yusufihsangorgel

Copy link
Copy Markdown
ContributorAuthor

Not directly. #534 is the load attempt itself failing (the fetch from fonts.gstatic.com throwing); after this PR that exception still happens once per failed load. What this PR fixes is one layer up: a failed load used to stay in pendingFontFutures, so every later GoogleFonts.pendingFonts() call rethrew the same completed error. If your Crashlytics noise is dominated by those repeats and the app uses pendingFonts(), this cuts it down to the single original failure; it does not prevent that first exception or add retrying.

@Piinks
Piinks self-requested a review July 21, 2026 22:20
@Yusufihsangorgel

Copy link
Copy Markdown
ContributorAuthor

@guidezpl thanks for approving! The CICD label was never added, so presubmit is still waiting on Awaiting CICD label. Could you apply it when you get a chance?

@guidezplguidezpl added the CICD Run CI/CD label Jul 31, 2026

@PiinksPiinks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@Piinks
Piinksforce-pushed the fix/google-fonts-pending-load-cleanup branch from ad312e4 to 3baf664CompareJuly 31, 2026 23:09
@flutter-dashboardflutter-dashboardBot removed the CICD Run CI/CD label Jul 31, 2026
@PiinksPiinks added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Jul 31, 2026
@auto-submit
auto-submitBot merged commit ac87e65 into flutter:mainJul 31, 2026
13 checks passed
Subhanshu20135 pushed a commit to The-Developer-Diaries/flutter that referenced this pull request Aug 3, 2026
…r#190441)
flutter/packages@5351d8c...ac87e65
2026-07-31 developeryusuf@icloud.com [google_fonts] Remove failed loads
from pendingFonts (flutter/packages#12240)
2026-07-31 34871572+gmackall@users.noreply.github.com
[google_sign_in_android] Keep `default_web_client_id` resource from
being stripped by resource shrinker (flutter/packages#12075)
2026-07-31 brunocorona.alcantar@gmail.com [vector_graphics] Provide
textDirection for semantics label to avoid crash without Directionality
(flutter/packages#11962)
2026-07-31 43054281+camsim99@users.noreply.github.com
[camera_android_camerax] Update `AGENTS.md` to improve video recording
integration tests (flutter/packages#12301)
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.
To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose
To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622
Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmitMerge PR when tree becomes green via auto submit AppCICDRun CI/CDp: google_fontstriage-frameworkShould be looked at in framework triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[google_font] pendingFonts() fails indefinitely after a single failed font loading

4 participants

@Yusufihsangorgel@mafreud@guidezpl@Piinks