Description
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
Additional context
AMP made a change in 2.1.0 - 2.1.1 of their plugin that breaks on WP < 5.6.
The reason it breaks is because the useDebounce function exposed in the @wordpress/compose package wasn't introduced into WP core until 5.6.
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.