-
Notifications
You must be signed in to change notification settings - Fork 295
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
Sign in with Google block causes E2E test failure due to console warning #10325
Comments
Updating the ["wp.blockEditor.transformStyles Failed to transform CSS. JSHandle@error"],["wp.blockEditor.transformStyles Failed to transform CSS. JSHandle@error"],["wp.blockEditor.transformStyles Failed to transform CSS. JSHandle@error"],["wp.blockEditor.transformStyles Failed to transform CSS. JSHandle@error"], "wp.blockEditor.transformStyles Failed to transform CSS. JSHandle@error"],["wp.blockEditor.transformStyles Failed to transform CSS. JSHandle@error"],["wp.blockEditor.transformStyles Failed to transform CSS. JSHandle@error"],["wp.blockEditor.transformStyles Failed to transform CSS. JSHandle@error"] |
(If this issue's fix is straightforward, including it in |
@tofumatt @aaemnnosttv the In newer builds of WP, the Therefore, a solution to this issue is to only enqueue the block script on the frontend if the SiwG module is connected, I have written an IB to this effect. While I was here I noticed that the other block scripts are prevented from being loaded on older WP versions that don't support blocks however I noticed this is not checked for the SiwG block and I've added this to the IB as it's quick to add in here while working on this fix. |
Thanks @benbowler that makes sense. We should really move to defining the block's scripts and styles in the If we do go this route, we should apply it to SiwG too. |
One of the reasons we register the block on the server is to support a dynamic render function:
Specifying this with Ultimately registration is recommended to be done both in PHP and JS, as per: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/ The SiwG block JS should indeed only be registered when the module is active though, that's a good point. 🤦🏻 |
Adding I've updated the ticket to include these references in the block.json for future proofing. |
TL;DR – let's go with the 1 line change for now as in the current PR and address the rest in a follow up (without making changes to the IB ✅ but I'll remove the bit about changing
@tofumatt I'm not suggesting that we don't register it on the server, but that we only register it this way – which is I think the intent we have now, as I said, the client side
You may have misunderstood the suggestion. Yes, we still want to register the block on the server side. What I meant was that we shouldn't be enqueuing the block's Looking at the IB, the note about changing the condition in Checking my own math, I found that when we remove our registered JS and allow it to be handled by core, it works, however block registration errors because no dependencies are defined and so the call to |
QA Update ✅
When SIWG is not connected Recording.1896.mp4When SIWG is not connected Recording.1897.mp4 |
Bug Description
The Sign in with Google block is erroneously loaded in an
admin-bar.test.js
E2E test:site-kit-wp/tests/e2e/specs/modules/search-console/admin-bar.test.js
Line 119 in 9d931c9
When it's loaded, it outputs a console warning that does not appear in production:
Steps to reproduce
npm run build:test
npm run test:e2e -- tests/e2e/specs/modules/search-console/admin-bar.test.js
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation Brief
This fix has been verified in this PR
includes/Modules/Sign_In_With_Google.php
to only add theblocks-sign-in-with-google
script (and styles) if the module is connected by adding a$this->connected()
check in the following if statement. Also add a check forBlock_Support::has_block_support()
to ensure it's only added on versions of WordPress which support blocks and to align with other blocks in the plugin.site-kit-wp/includes/Modules/Sign_In_With_Google.php
Line 309 in 52c7824
Test Coverage
QA Brief
Changelog entry
The text was updated successfully, but these errors were encountered: