Replace site-settings snackbar with My Site connectivity banner#22834
Draft
jkmassel wants to merge 2 commits intojkmassel/pr-22785-followupsfrom
Draft
Replace site-settings snackbar with My Site connectivity banner#22834jkmassel wants to merge 2 commits intojkmassel/pr-22785-followupsfrom
jkmassel wants to merge 2 commits intojkmassel/pr-22785-followupsfrom
Conversation
Follow-up to #22785: the capability fetch (apiRoot + themes?status=active) was firing on every onResume of the My Site tab. Dedup with an in-memory set keyed by site.id so it only runs once per ViewModel session. Pull-to-refresh bypasses the gate so users can still force a fresh fetch.
Follow-up to #22785: the snackbar from a failed editor capabilities fetch is non-actionable and disappears, leaving the user with no way to recover. Move the fetch into a new SiteConnectivityBannerViewModelSlice that posts a persistent SingleActionCard banner (with retry) into the My Site header when the fetch fails and there's no cache. Generic copy because the fetch failure signals broader connectivity issues, not just editor problems.
Collaborator
Generated by 🚫 Danger |
Contributor
|
|
Contributor
|
|
Contributor
🤖 Build Failure AnalysisThis build has failures. Claude has analyzed them - check the build annotations for details. |
17973a8 to
5d99212
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Follow-up to #22785 (review feedback from @nbradbury). The snackbar from a failed editor capabilities fetch is non-actionable and disappears, leaving the user with no way to recover. On a cold launch with flaky network, it pops up before the user has done anything.
This PR moves the fetch into a new
SiteConnectivityBannerViewModelSlicethat posts a persistentSingleActionCardbanner into the My Site header (last position, below the reauth banner) when the fetch fails AND there's no cache. Tapping the banner retries the fetch (bypassing the per-session dedup). Successful fetch — or a cached value — clears the banner.The banner copy is generic — "Unable to connect to your site. Some functionality might be limited." — because the apiRoot fetch failure signals broader site reachability problems, not just editor issues.
Why a slice?
MySiteViewModelalready carriesLargeClass/LongMethod/LongParameterListsuppressions. The fetch is logically self-contained (takes aSiteModel, posts a card or null), so it makes sense to extract. The slice owns the per-site session dedup that #22833 introduced inline — same behavior, dedicated home, dedicated tests.Stacking
This PR is stacked on #22833 (the throttling change). Once #22833 merges, rebase this on trunk and the base will switch to
trunkautomatically.The diff against #22833's branch is small (the slice + the banner UX). Reviewing this on top of #22833 keeps the throttling and the banner as separate logical changes.
Testing instructions
Covered by 9 new unit tests in
SiteConnectivityBannerViewModelSliceTest:clearBanner()clearsManual:
Related