Audience Selection Panel rendered before the feature has been set up
Bug Description
Issue discovered during bug bash. Asana task here
The Audiences Selection Panel component is rendered into the DOM before the feature has been set up.
I spotted this when I noticed that a request to sync-audiences is made when landing on the dashboard prior to the Audience Segmentation Setup CTA Banner being displayed and actioned.
We should not be rendering the selection panel at all prior to the feature being set up.
Screenshots
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- If the Audience Segmentation feature has not yet been set up for the current user, the Audience Selection Panel should not be rendered into the DOM.
Implementation Brief
- [ ] In the
DashboardMainAppcomponent, retrieveconfiguredAudiencesvia thegetConfiguredAudiences()selector. Extend the condition for renderingAudienceSelectionPanelto include a check forconfiguredAudiencesbeing truthy.
https://github.com/google/site-kit-wp/blob/3ff3c69cce3f17ec310f57e0a3cfe8aebe2e2759/assets/js/components/DashboardMainApp.js#L297
Test Coverage
- No new tests needed.
QA Brief
- Set up Site Kit with the
audienceSegmentationfeature flag enabled, and Analytics connected to a property that is out of the gathering data state. - Verify that the Audience Selection Panel is not rendered into the DOM. Check for the presence of an element with the class
.googlesitekit-audience-selection-panelas seen in the screenshot in the Feature Description. This should not be present. - Click on Enable groups to set up the Audience Segmentation feature.
- Verify that the Audience Selection Panel is now rendered into the DOM.
Changelog entry
- Prevent rendering of the Audience Selection Panel before the feature is set up, ensuring it only renders after setup is complete.
Thank you for drafting the IB, @techanvil !
- In the
DashboardMainAppcomponent, retrieveconfiguredAudiencesvia thegetConfigurableAudiences()selector. Extend the condition for renderingAudienceSelectionPanelto include a check forconfiguredAudiencesbeing truthy.
Just to confirm, did you mean the core/user getConfiguredAudiences selector instead?
Thanks for spotting that, @nfmohit! It was indeed a typo, which I've fixed. Back to you for another pass :)
IB ✅
QA Update ✅
Verified good as per below. Moving ticket to approval.
-
Before the audience tiles were set up, the class .googlesitekit-audience-selection-panel appeared under the 'latest release' branch.
-
When switched to 'develop' Branch, the class .googlesitekit-audience-selection-panel disappeared.
-
Under develop Branch, after the audience tiles were set up, the class .googlesitekit-audience-selection-panel now appeared.
https://github.com/user-attachments/assets/e0b67570-f1ab-4272-9038-f878fe29a1d7