-
Notifications
You must be signed in to change notification settings - Fork 291
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
Implement the full-tile error states for the Audience Tile #8147
Comments
Note, I've moved this to the backlog pending the addition of the full width error state as a GitHub issue, which this issue may depend on. |
The full width error state is now defined and added as a dependency for this issue, which is ready for AC. |
Hi @hussain-t, just letting you know I've moved this back to Backlog as the final in-progress changes to the design doc, relating to audience caching, will probably affect the AC for this one (we probably need to handle an audience sync error here). Please feel free to get preliminary AC ready in the meantime. |
Hi again @hussain-t! As the audience caching aspect of the design doc has been sufficiently finalised, I've moved this back to AC. |
Thanks @hussain-t, nice work here so far on the IB. A couple of points:
It's worth bearing in mind that
Hmm, I think it would be cleaner to conditionally render |
Thanks for the valuable feedback, @techanvil. I've updated the IB accordingly. |
Thanks @hussain-t! Nice work, that LGTM. IB ✅ |
Hey @hussain-t, while working on the IB for #8190 I've noticed that one detail of the AC has been missed in the IB here.
As per the above point, we need to ensure the Info Notice is not displayed when we are showing the Full Width Error Banner. Please can you update the IB accordingly? |
QA Update
|
Thanks @kelvinballoo, this is indeed expected for now. We do have an issue to only show the info notice when there is relevant data for it, which implies it won't show up while the tiles are in the loading state, but this is currently in the backlog for post-launch: |
QA Update ✅Great, thanks for the confirmation @techanvil . I was able to do the proper change in the URL and I could interchange the positions. ✅ The tiles on mobile and desktop are appearing as expected. ✅ The errors are showing up accordingly. ✅ |
@kelvinballoo it looks like only the catch-all error case was tested here. Was the permissions error case also tested as mentioned in the AC? |
@aaemnnosttv , apologies! Yes, only the catch-all error was tested. Missed out on the permissions error. @ankitrox , could you update the QAB for how to test for the Permissions error please? |
QA Update ✅Permissions error variant tested by changing the tweak extension response to:
The Permission error variant appeared accordingly and is looking good on desktop, mobile and tablet viewports.
The catch-all variant was tested good already ✅ |
Thanks @kelvinballoo ! |
Feature Description
Implement the error handling for Audience Tiles for the cases where an error occurs when retrieving the audience data.
Note that this entails showing the Audience Tile Error when an individual tile is in the error state, or the Full Width Error Banner in the case where all audience tiles are in an error state.
See audience tiles > error states in the design doc.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation Brief
In
assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTilesWidget/AudienceTiles.js
:getErrorForSelector
by passing the appropriate report options:reportOptions
totalPageviewsReportOptions
audienceResourceName
):topCitiesReportOptions
topContentReportOptions
topContentPageTitlesReportOptions
individualTileErrors
: To track errors for each specific audience tile, especially for the per-tile reports (topCitiesReportOptions
,topContentReportOptions
,topContentPageTitlesReportOptions
).allTilesError
: To determine if errors occur in the reports that apply to all tiles collectively (reportOptions
andtotalPageviewsReportOptions
), indicating that a full-width error banner should be displayed.useEffect
hook to manage the error handling process:configuredAudiences
array.audienceResourceName
, check if there are any errors associated with the per-tile reports (topCitiesReportOptions
,topContentReportOptions
,topContentPageTitlesReportOptions
).individualTileErrors
state, mapping eachaudienceResourceName
to its corresponding errors.reportOptions
andtotalPageviewsReportOptions
). If errors are found in these, setallTilesError
totrue
.configuredAudiences
entry has associated errors for the per-tile reports, or if there are errors in the collective reports, setallTilesError
totrue
.AudienceSegmentationErrorWidget
component ifallTilesError
istrue
, passing in all collected errors:Object.values( individualTileErrors ).flat()
to consolidate all errors into a single, flat array.reportOptions
,totalPageviewsReportOptions
) and pass this combined array to theAudienceSegmentationErrorWidget
component as theerrors
prop.allTilesError
isfalse
, and if an error exists inindividualTileErrors
, render theAudienceTileError
component within theWidget
directly withinAudienceTiles
(insidevisibleAudiences.map()
), passing theerrors
prop.AudienceTile
component.AudienceTileLoading
logic intoAudienceTiles
:AudienceTileLoading
logic intoAudienceTiles
(insidevisibleAudiences.map()
) and conditionally renderAudienceTileLoading
directly inAudienceTiles
based on the loading state before checking for errors or rendering theAudienceTile
component.In
assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceTilesWidget/AudienceTile/index.js
:AudienceTileLoading
component from theAudienceTile
component as it will now be handled inAudienceTiles
.AudienceTiles
, remove the unnecessary props.Hide the
InfoNoticeWidget
component when an error occurs:In
assets/js/modules/analytics-4/components/audience-segmentation/dashboard/AudienceSegmentationErrorWidget.js
:useEffect
hook, set the global state to hide theInfoNoticeWidget
using thesetValue
action from theCORE_UI
store.handleRetry
callback function to reset the state (usingsetValue
fromCORE_UI
) to show theInfoNoticeWidget
again once the errors are cleared.handleRetry
function to theonRetry
prop of theReportErrorActions
component.In
assets/js/modules/analytics-4/components/audience-segmentation/dashboard/InfoNoticeWidget/index.js
:AudienceSegmentationErrorWidget
to hide theInfoNoticeWidget
component.InfoNoticeWidget
component if the global state value is set totrue
.InfoNoticeWidget
component as usual.Test Coverage
AudienceTilesWidget/index.stories.js
andAudienceTile/index.stories.js.
AudienceTilesWidget/index.test.js
.QA Brief
Note:
Make sure https://oi.ie is added as "Custom Site URL" in tester settings.
It may happen that the IDs given for
Returning visitors
andAll visitors
may get changed in case the audiences have been archived and re-created in Google Analytics. In this QAB, ID forReturning visitors
is8587716470
andAll visitors
is2786548370
. It's better to rungooglesitekit.data.select( 'modules/analytics-4' ).getAvailableAudiences();
command in browser and confirm the IDs for these audiences and replace with the correct one in case those are changed.Enable the audience segmentation feature and enable
Visitor groups
in Site Kit settings.Select
Returning visitors
andAll visitors
to show in audience tiles widget area from the selection panel.Using the Tweak Chrome extension, create a rule as follows.
Rule 1
.*/wp-json/google-site-kit/v1/modules/analytics-4/data/report.*8587716470.*
(.*)
GET
500
Rule 2
.*/wp-json/google-site-kit/v1/modules/analytics-4/data/report.*8587716470(?!.*2786548370).*
8587716470
only and no other audience resource name (2786548370
) is present in the request(.*)
GET
500
Applications > Session storage
(in chrome) search forreport
and clear all report data.Single tile error
Enable rule 2 above in tweak and refresh the dashboard, make sure there are no reports in session storage so that request can be intercepted.
Notice that
Returning visitors
tile should show error.All visitors
tile should show the data properly.All tiles error
Enable rule 1 above in tweak and refresh the dashboard, make sure there are no reports in session storage so that request can be intercepted.
Notice that full width error banner is shown and no tile will be shown.
Also, info notice banner Add the Info Notice (Storybook) #8137 is not shown when full width error banner is being displayed.
Changelog entry
The text was updated successfully, but these errors were encountered: