-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A few Ad Blocking Recovery components are rendered unconditionally #7179
Comments
AC ✅ |
@tofumatt it depends on the case; I think most will not make sense to keep because checking this within a component that itself should only render when that feature/condition should be guarding its render would also require that you use that feature within every hook which may not be possible in some cases. So that's largely the issue here, which is that the check within the component does not protect against side-effects from hooks. For example, we wouldn't check if a module is active in every component, right? It depends on the component, but we always need to be mindful of the unconditional nature of hooks. This same issue happened very recently with KMW: #6262 (comment) If we really want to apply it at the component level, then we'd need to leverage an HOC, e.g.
The majority of ABD components will be rendered here so I'd so all of those shouldn't be a concern for this same reason. Otherwise IB LGTM but I haven't verified the exhaustiveness of the components affected here. |
@aaemnnosttv Fair point! I did think that as well—if the feature flag weren't enabled the selectors in those components would still run, so removing them makes sense. I did check the components exhaustively, so this IB should be good-to-go now 🙂 |
IB ✅ |
QA Update:
|
Do you mean it's not appearing when the Ad Blocker Detection feature flag is disabled? If so that should be fine. If it was previously appearing with the feature flag enabled and still isn't… I don't think this should've caused that change, but let me know which it is. 🙂 |
@tofumatt the feature flag is enabled and the CTA is not appearing on the Site Kit dashboard. If it's not related to this issue I can move this on and flag this in the channel to Arafat. |
QA Update: ✅The issue with the ABR CTA not appeaing on the Site Kit dashboard is outside of this ticket. Have raised it in Slack. Verified:
|
Bug Description
As spotted by the eagle-eyed @aaemnnosttv, a few of the Ad Blocking Recovery "entrypoint" component are being rendered unconditionally instead of only being rendered when the
adBlockerDetection
feature flag is enabled which is not correct.While this is not causing any bugs at the moment (because the components themselves doesn't cause any side effect that depends on things (ie. API endpoints) behind the the feature flag, it should always be rendered when the feature flag is enabled for consistently and to avoid the problems similar to one reported here for Key Metrics.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
adBlockerDetection
feature flag inside the component or any of it's children should be removed as the component will not be rendered at all if the flag is not enabled.AdBlockingRecoveryCTA
andAdBlockingRecoveryToggle
components are rendered unconditionally inSettingsForm
andSettingsView
but this may not be an exhausting list.Implementation Brief
site-kit-wp/assets/js/modules/adsense/components/settings/SettingsForm.js
Lines 128 to 130 in b997e6e
useFeature( 'adBlockerDetection' )
hook returnstrue
site-kit-wp/assets/js/modules/adsense/components/common/AdBlockingRecoveryCTA.js
Line 40 in b997e6e
site-kit-wp/assets/js/modules/adsense/components/common/AdBlockingRecoveryToggle.js
Line 46 in b997e6e
site-kit-wp/assets/js/googlesitekit-ad-blocking-recovery.js
Line 39 in b997e6e
Test Coverage
QA Brief
adBlockerDetection
feature flag using a site that has AdSense set up and can see the Ad Blocker Detection settings in the AdSense settings.adBlockerDetection
feature flag and visit AdSense settings. Ad Blocking Detection CTA should not appear in "Edit" mode for AdSense and there should be no browser console errors.Changelog entry
The text was updated successfully, but these errors were encountered: