Show errors instead of infinite loading state in AdSense V2 setup flow
See original GitHub issueBug Description
In case of API errors, the V2 setup currently remains in an infinite loading state instead of showing the error to the user.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- The AdSense V2
SetupMaincomponent should be adjusted to show any relevant errors: Similar to the V1 version of the component, if there are any AdSense API errors (viahasErrorsselector), it should show the errors via the AdSenseErrorNoticescomponent.- In such cases, only that component should be shown instead of the regular
SetupCreateAccount,SetupSelectAccount, orSetupAccount.
- In such cases, only that component should be shown instead of the regular
- The AdSense
ErrorNoticescomponent should be slightly adjusted: If theadsenseSetupV2feature flag is active, it shouldn’t call theerrorToStatusutility function to decide whether an error should show. Any error should show in the V2 flow.
Implementation Brief
SetupMain component
Within file assets/js/modules/adsense/components/setup/v2/SetupMain.js:
- Check for AdSense errors via the
MODULES_ADSENSEstore’shasErrorsselector, which returns a boolean. - Update the
if/elsesequence which determinesviewComponentto first check the result ofhasErrorsand setviewComponentto<ErrorNotices />if so, as seen in the V1SetupMaincomponent: https://github.com/google/site-kit-wp/blob/64e9b6c7f7576d33b23f7105a1e4311c0fa40b4a/assets/js/modules/adsense/components/setup/SetupMain.js#L458
ErrorNotices component
Within file assets/js/modules/adsense/components/common/ErrorNotices.js:
- Use the
useFeaturehook to check whether theadsenseSetupV2feature flag is enabled. - Update the rendered
StoreErrorNoticescomponent, passingundefinedfor theshouldDisplayErrorprop if the feature flag is enabled, otherwise continue to pass theshouldDisplayErrorcallback.
Storybook
- Add a new story for V2
SetupMaindisplaying the error state.
Test Coverage
- No new tests needed.
QA Brief
- Ensure the Adsense Setup V2
Error Noticestory displays the error instead of the loading state. Story URL path -/story/modules-adsense-components-setup-v2-setupmain--error-notice - Currently, we can’t test the error notice scenario using the tester plugin. Refer to this comment.
Changelog entry
- Update the AdSense SetupMain component to show existing errors.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Fix AdSense crawler issues - Google Support
If the AdSense ads crawler can't access your content, refer to the following list of crawler issues to help you fix the problem....
Read more >Site Kit by Google – Analytics, Search Console, AdSense, Speed ...
Quick setup for multiple Google tools without having to edit the source code of your site; Metrics for your entire site and for...
Read more >Evolving "nofollow" – new ways to identify the nature of links
This has now changed. All the link attributes— sponsored , ugc , and nofollow —are treated as hints about which links to consider...
Read more >readme.txt - HSDC
2. Follow the instructions in the setup flow. 3. ... Fix an infinite loading state when attempting to create a new Analytics account...
Read more >readme.txt
2. Follow the instructions in the setup flow. 3. ... Fix infinite loading state for components relying on gathering or zero data reports....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@hussain-t The observation by @wpdarren is valid. What you’re describing is correct, but that is particularly the problem why this is not working like it should. We need to make sure that we don’t just keep showing the
ProgressBarwhen there are errors.In general, looking for
undefinedvalues as the indicator for whether to show a loading state is a bit unreliable, for this very reason, that the request could have an error, in which case it should be displayed. We should use! hasFinishedResolutionfor the relevant selector to show the loading state.Can you please open a PR based on
mainto fix this?QA Update: ✅
/story/modules-adsense-components-setup-v2-setupmain--error-notice