site-kit-wp icon indicating copy to clipboard operation
site-kit-wp copied to clipboard

Console error on view only dashboard.

Open mohitwp opened this issue 1 year ago • 5 comments

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

  1. Set up SK with Analytics as Admin A.
  2. Enable groups.
  3. Share Analytics with a non admin user role.
  4. Visit the view-only dashboard.
  5. 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

image

Full list of errors:

image


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 isSettingUpAudiences selector from the MODULES_ANALYTICS_4 datastore to determine if audience settings are in the process of being set up.
  • [x] In the useMount hook, check if the audience settings are still being processed and return early if true.
  • [x] Otherwise, proceed with the rest of the logic.

In assets/js/modules/analytics-4/datastore/audiences.js:

  • [x] Update the enableSecondaryUserAudienceGroupMain action 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.

mohitwp avatar Oct 01 '24 13:10 mohitwp

Thanks for raising this, @mohitwp. I discovered some additional console errors when running through the steps to reproduce, and have updated the issue accordingly.

techanvil avatar Oct 03 '24 15:10 techanvil

IB ✅

techanvil avatar Oct 14 '24 16:10 techanvil

@techanvil Update : I tested https://github.com/google/site-kit-wp/issues/9411 and notice same console error for secondary admin main dashboard.

Image

mohitwp avatar Oct 16 '24 04:10 mohitwp

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.

techanvil avatar Oct 16 '24 09:10 techanvil

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. Image

kelvinballoo avatar Oct 24 '24 09:10 kelvinballoo