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

AdSense connect graphics are loaded regardless of CTA dismissal

Open aaemnnosttv opened this issue 1 year ago • 1 comments

Bug Description

The AdSense connect CTA shown at the bottom of the dashboard lazy loads the 3 graphics shown for its slides. Currently, it can be observed that these graphics are being requested by the browser even when the CTA is dismissed and shouldn't be rendered at all.

This seems to be due to a timing issue where it is briefly rendered (triggering these requests) before it is removed again.

Steps to reproduce

  1. Load the dashboard with the AdSense connect CTA dismissed
  2. Observe requests in the network console for chunks related to the adsense graphics

Screenshots

image


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • AdSense CTA graphics should only be loaded on the dashboard when the adsense-connect-cta is not dismissed

Implementation Brief

  • In assets/js/modules/adsense/components/dashboard/AdSenseConnectCTAWidget.js:
    • Instead of rendering <WidgetNull /> conditionally, render <Widget /> containing <AdSenseConnectCTA /> first if both adSenseModuleConnected and hasDismissedWidget are explicitly false (they return an undefined value until resolved, which is falsey. Thus, we need to check if they're === false explicitly).
    • Afterwards, return <WidgetNull /> unconditionally if the prior return statements are not executed.

Test Coverage

  • No tests need to be added/updated.

QA Brief

Changelog entry

aaemnnosttv avatar Oct 14 '22 20:10 aaemnnosttv

IB :white_check_mark:

techanvil avatar Oct 17 '22 13:10 techanvil

@wpdarren I'm not able to reproduce this issue on latest environment. Can you please check if you are able to recreate this and 0.js, 1.js, 2.js chunks are loading for you ? For me googlesitekit-modules-adsense-5a9b4bcea7febf15e592.js file is getting load on latest environment.

image

image

image

mohitwp avatar Oct 27 '22 11:10 mohitwp

@mohitwp yes, I was also unable to recreate the issue, so its difficult to know if the ticket fixes it.

@aaemnnosttv is it possible that this can only be seen on a local setup? if not, would you be able to create a screencast?

wpdarren avatar Oct 31 '22 01:10 wpdarren

@wpdarren @mohitwp – the 0,1,2 js files are only present in a development build, but the issue is not development/local specific, the assets just have different IDs in a production build, (currently 31,32,33 plus a hash) so the QAB should have surfaced this.

I did verify that the issue is fixed though as can be seen here with the current release on the left and the development build on the right but feel free to double check.

image

You can see the JS chunk relates to the AdSense svg graphic here: image

aaemnnosttv avatar Nov 01 '22 19:11 aaemnnosttv

QA Update ⚠️

Thank you @aaemnnosttv !

  • Verified on dev and latest environment.
  • On latest environment requests in the network console for chunks related to the AdSense graphics are getting load (31, 32 and 33).
  • On dev environment chunks related to the AdSense graphics are not getting load when CTA is dismissed. (31, 32 and 33).

@sashadoes

Question :- Initial issue is resolve now. But, I've noticed that in case when CTA is not dismissed then chunks related to the AdSense graphics are getting load on dev. (33.js,34.js and 35.js). Here in this case these files are different from the latest environment. On latest environment (31.js, 32.js and 33.js) chunks files are getting load. Did we changed or removed these files so that 31.js and 32.js files are not getting load in this case ?

Latest -

image

Dev -

image

image

Dev :-

image

image

image

When CTA is not dismissed -

image

mohitwp avatar Nov 02 '22 08:11 mohitwp

Hi @mohitwp. Thanks for your question. I have not changed any file load logic within this ticket. Looks like the same files have different chanks on dev assuming the dev build is in place. I personally do not see any issues.

sashadoes avatar Nov 02 '22 11:11 sashadoes

QA Update ✅

Thank you @sashadoes.

Hi @mohitwp. Thanks for your question. I have not changed any file load logic within this ticket. Looks like the same files have different chanks on dev assuming the dev build is in place. I personally do not see any issues.

  • Verified on dev and latest environment.
  • On latest environment requests in the network console for chunks related to the AdSense graphics are getting load (31, 32 and 33).
  • On dev environment chunks related to the AdSense graphics are not getting load when CTA is dismissed. (31, 32 and 33).
  • When CTA is not dismissed then chunks related to the AdSense graphics are getting load on dev. (33.js,34.js and 35.js). Here in this case these files are different from the latest environment. On latest environment (31.js, 32.js and 33.js) chunks files are getting load. As per Sasha this is just case of having different chunks on dev environment.

Latest -

image

Dev :-


image

image

image

When CTA is not dismissed -

image

mohitwp avatar Nov 02 '22 13:11 mohitwp