site-kit-wp
site-kit-wp copied to clipboard
Console error on view only dashboard.
Bug Description
If the Audience Segmentation feature flag is set up and Analytics is shared, a number of console errors appear when visiting the view-only dashboard for the first time.
Steps to reproduce
- Set up SK with Analytics as Admin A.
- Enable groups.
- Share Analytics with a non admin user role.
- Visit the view-only dashboard.
- See the errors in the JS console.
Note that the errors won't appear on the next page load. To reproduce the errors again, reset Site Kit and repeat the above steps.
Screenshots
Full list of errors:
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- There should not be any console errors when visiting the dashboard as a secondary admin or view-only user when the Audience Segmentation feature has been set up.
Implementation Brief
In assets/js/modules/analytics-4/components/audience-segmentation/dashboard/SecondaryUserSetupWidget/index.js:
- [x] Use the
isSettingUpAudiencesselector from theMODULES_ANALYTICS_4datastore to determine if audience settings are in the process of being set up. - [x] In the
useMounthook, check if the audience settings are still being processed and return early iftrue. - [x] Otherwise, proceed with the rest of the logic.
In assets/js/modules/analytics-4/datastore/audiences.js:
- [x] Update the
enableSecondaryUserAudienceGroupMainaction to return an empty object{}at the end to prevent destructuring errors upon the success of the action.
Test Coverage
- No new tests are required for this change.
QA Brief
- Follow the "Steps to reproduce".
- Verify that there are no console errors in the view-only dashboard.
Changelog entry
- Prevent console errors appearing when visiting the dashboard as a secondary admin or view-only user after the Audience Segmentation feature has been set up.
Thanks for raising this, @mohitwp. I discovered some additional console errors when running through the steps to reproduce, and have updated the issue accordingly.
IB ✅
@techanvil Update : I tested https://github.com/google/site-kit-wp/issues/9411 and notice same console error for secondary admin main dashboard.
Thanks for the heads up @mohitwp. The IB should fix this for all secondary users. I've updated the AC to cover secondary admins as well as view-only users to make it clear.
QA Update ✅
Tested this and there was no console error for a view-only user. Verified for a second admin as well and there was no console error as previously reported.
Moving ticket to Approval.
https://github.com/user-attachments/assets/85268d3d-91fb-48e5-bedf-748766946d05
As second admin, there were no previously reported console errors.
The below errors were more to search console not having proper access.