Skip to content

WP <= 5.5.5: post edit and create pages throw errors with the latest version of AMP plugin (>= 2.1.0) #6236

Closed
@nbcsteveb

Description

@nbcsteveb

Bug Description

On WP versions <= 5.5.5 w/ latest AMP Plugin (2.1.*) post edit and create pages throw errors with the latest version of AMP plugin.

Expected Behaviour

The post create or edit page screen should load without throwing any errors.

Steps to reproduce

Given: WordPress version below 5.6 (<= 5.5.5)
And: AMP Plugin v2.1.0 or v2.1.1 is installed.
When: User tries to create or edit a post.
Then: There's an error thrown.

TypeError: Object(...) is not a function
at /wp-content/plugins/amp/assets/js/amp-block-validation.js?ver=563a00395a4f44a548658de7c61d656b:15:10628
at re (/wp-content/plugins/amp/assets/js/amp-block-validation.js?ver=563a00395a4f44a548658de7c61d656b:15:10773)
at je (/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:78:476)
at ph (/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:215:173)
at lh (/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:126:409)
at O (/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:121:71)
at ze (/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:118:14)
at /wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:53:49
at unstable_runWithPriority (/wp-includes/js/dist/vendor/react.min.js?ver=16.9.0:26:340)
at Ma (/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.9.0:52:280)

Screenshots

image

Additional context

AMP made a change in 2.1.0 - 2.1.1 of their plugin that breaks on WP < 5.6.

af6d465

The reason it breaks is because the useDebounce function exposed in the @wordpress/compose package wasn't introduced into WP core until 5.6.

WordPress/gutenberg#25948

https://developer.wordpress.org/block-editor/contributors/versions-in-wordpress/

If you search for the word debounce in this file you will get zero (0) hits.

https://github.com/WordPress/WordPress/blob/5.5.5/wp-includes/js/dist/compose.js

If you search here, you will see the debounce functionality included:

https://github.com/WordPress/WordPress/blob/5.6/wp-includes/js/dist/compose.js#L2606


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation brief

QA testing instructions

Demo

Changelog entry

Metadata

Metadata

Assignees

Labels

BugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions