site-kit-wp
site-kit-wp copied to clipboard
AdSense connect graphics are loaded regardless of CTA dismissal
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
- Load the dashboard with the AdSense connect CTA dismissed
- Observe requests in the network console for chunks related to the adsense graphics
Screenshots
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 bothadSenseModuleConnected
andhasDismissedWidget
are explicitlyfalse
(they return anundefined
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.
- Instead of rendering
Test Coverage
- No tests need to be added/updated.
QA Brief
Changelog entry
IB :white_check_mark:
@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.
@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 @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.

You can see the JS chunk relates to the AdSense svg graphic here:
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 -
Dev -
Dev :-
When CTA is not dismissed -
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.
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 -
Dev :-
When CTA is not dismissed -