Skip to content
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

Block Editor: TypeError: Cannot read properties of undefined (reading 'domReady') #38110

Open
pavel-sf opened this issue Jun 28, 2024 · 2 comments
Labels
[Feature] Subscriptions All subscription-related things such as paid and unpaid, user management, and newsletter settings. [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] TBD [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! [Status] Priority Review Triggered The guild in charge of triage has been notified of this issue in Slack Triaged [Type] Bug When a feature is broken and / or not performing as intended

Comments

@pavel-sf
Copy link

pavel-sf commented Jun 28, 2024

Impacted plugin

Jetpack

Quick summary

It seems, that u find solution here, but I cant find D111593-code.
Automattic/wp-calypso#76936
Code with JS is located under the <footer>, but object of window.wp is undefined

Steps to reproduce

Launch site with custom template.

A clear and concise description of what you expected to happen.

No response

What actually happened

No response

Impact

One

Available workarounds?

No but the platform is still usable

Platform (Simple and/or Atomic)

No response

Logs or notes

view.js?m=1716233624:1 Uncaught TypeError: Cannot read properties of undefined (reading 'domReady')
    at 47701 (view.js?m=1716233624:1:1782)
    at r (view.js?m=1716233624:1:1889)
    at view.js?m=1716233624:1:2725
    at view.js?m=1716233624:1:4129
    at view.js?m=1716233624:1:4133
@pavel-sf pavel-sf added [Type] Bug When a feature is broken and / or not performing as intended Needs triage Ticket needs to be triaged labels Jun 28, 2024
@github-actions github-actions bot added [Status] Priority Review Triggered The guild in charge of triage has been notified of this issue in Slack [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] High labels Jun 28, 2024
@jeherve jeherve added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Pri] TBD Triaged and removed [Pri] High Needs triage Ticket needs to be triaged labels Jun 28, 2024
@jeherve
Copy link
Member

jeherve commented Jun 28, 2024

Launch site with custom template.

Could you expand on this a little bit, so we can attempt to reproduce the issue?

  • Does the error appear in the block editor, on the frontend, or on both?
  • Does this error appear on all pages of your site, or on pages that use specific blocks?
  • Do you have any other plugins installed on your site? Does the problem disappear when you deactivate a specific plugin?
  • Is that custom template something we could install on a test site to attempt to reproduce the problem?

Thank you!

@jeherve jeherve changed the title TypeError: Cannot read properties of undefined (reading 'domReady') Block Editor:| TypeError: Cannot read properties of undefined (reading 'domReady') Jun 28, 2024
@jeherve jeherve changed the title Block Editor:| TypeError: Cannot read properties of undefined (reading 'domReady') Block Editor: TypeError: Cannot read properties of undefined (reading 'domReady') Jun 28, 2024
@anomiex
Copy link
Contributor

anomiex commented Jun 28, 2024

The line and column numbers in the trace seem to match up with Jetpack 13.5's _inc/blocks/subscriptions/view.js.

I was able to reproduce something resembling this with the following steps:

  1. Launch a fresh JN site, default settings.
  2. Connect Jetpack (free plan is fine). Enable the Newsletter module.
  3. Install and activate the Twenty Twenty theme.
  4. Open the Customizer.
  5. Add a Subscribe block in the footer. Don't publish.
  6. Click the About link at the top of the page.

I suspect this bit of code

// If this is a customizer preview, enqueue the dependencies and render the script directly to the preview after autosave.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( is_customize_preview() && ! empty( $_GET['customize_autosaved'] ) ) {
// The Map block is dependent on wp-element, and it doesn't appear to to be possible to load
// this dynamically into the customizer iframe currently.
if ( 'map' === $type ) {
echo '<div>' . esc_html_e( 'No map preview available. Publish and refresh to see this widget.', 'jetpack' ) . '</div>';
echo '<script>';
echo 'Array.from(document.getElementsByClassName(\'wp-block-jetpack-map\')).forEach(function(element){element.style.display = \'none\';})';
echo '</script>';
} else {
echo '<script id="jetpack-block-' . esc_attr( $type ) . '" src="' . esc_attr( $view_script ) . '&amp;ver=' . esc_attr( $script_version ) . '"></script>';
}
}

it adds the block's view script manually, without adding any of its dependencies first.

@jeherve jeherve added the [Feature] Subscriptions All subscription-related things such as paid and unpaid, user management, and newsletter settings. label Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Subscriptions All subscription-related things such as paid and unpaid, user management, and newsletter settings. [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] TBD [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! [Status] Priority Review Triggered The guild in charge of triage has been notified of this issue in Slack Triaged [Type] Bug When a feature is broken and / or not performing as intended
Projects
Development

No branches or pull requests

3 participants