-
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
Standard AMP mode is being determined as secondary
rather than primary
AMP mode (V2 AMP plugin).
#5118
Comments
secondary
rather than primary
AMP mode (V2 AMP plugin).
@felixarntz looking back I found #2998 where we intentionally changed AMP primary to be always handled as secondary which essentially makes it impossible for |
@techanvil The ACs overall look good, I added a bit more detail under the first point, to clarify that this is effectively a revert (plus one single change that had also been found in the related issue #2998). If this looks good to you, feel free to move to IB. |
Thanks @felixarntz, the updated AC LGTM, moving to IB 👍 |
@nfmohit we need to revert #3577 instead of #3557
This is missing in IB |
Thank you for your kind review on this, @eugene-manuilov! Whoops, that was a typo. I've updated it. Thank you!
I think I actually misunderstood this part earlier. I didn't add anything about this in the IB because the site-kit-wp/includes/Context.php Lines 325 to 330 in caa4384
However, now that I read the ACs again, I understand that this logic should only run if the remaining logic returns Thank you! |
Thanks, @nfmohit. IB ✔️ |
QA Update: ✅Verified:
|
Bug Description
When using the V2 AMP plugin and selecting Standard mode, it's being interpreted as
'secondary'
mode in Site Kit, when it should be'primary'
.This is because
STANDARD_MODE_SLUG
is being grouped withTRANSITIONAL_MODE_SLUG
andREADER_MODE_SLUG
in this condition:site-kit-wp/includes/Context.php
Lines 369 to 381 in dce817b
Steps to reproduce
getAMPMode
andisPrimaryAMP
selectors. They will return'secondary'
andfalse
respectively.Screenshots
Additional Context
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Context::get_amp_mode()
(and related selectors) should always reflect the current AMP mode based on the AMP plugin configuration (if active) and whether the Web Stories plugin is active.Context::get_amp_mode()
returnsfalse
, add an extra condition for whether the Web Stories plugin is active (viadefined( 'WEBSTORIES_VERSION' )
), and if so returnAMP_MODE_SECONDARY
instead offalse
.false
logic paths, since otherwise the site is already using AMP in some way, and since Web Stories are AMP, it would not affect the outcome in those cases.Context::is_amp()
) regardless of whether the AMP mode is primary or secondary.Implementation Brief
includes/Context.php
:get_amp_mode()
method:AMP_MODE_SECONDARY
whenWEBSTORIES_VERSION
is defined to only run when the remaining logic in the method returnsfalse
, i.e. if any other logic in the method returnsfalse
, check ifWEBSTORIES_VERSION
is defined and returnAMP_MODE_SECONDARY
in that case.assets/js/modules/tagmanager/components/common/WebContainerSelect.js
:null
whenisPrimaryAMP
istrue
.Test Coverage
assets/js/modules/tagmanager/components/common/WebContainerSelect.test.js
:should render nothing in a primary AMP context
.QA Brief
googlesitekit.data.select('core/site').getAMPMode()
should return correct amp mode (primary/secondary).Changelog entry
The text was updated successfully, but these errors were encountered: