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

WP 4.9 Pollyfill JS Compatablity. #6100

Closed
milindmore22 opened this issue Apr 23, 2021 · 4 comments · Fixed by #6119
Closed

WP 4.9 Pollyfill JS Compatablity. #6100

milindmore22 opened this issue Apr 23, 2021 · 4 comments · Fixed by #6119
Assignees
Labels
Bug Something isn't working
Milestone

Comments

@milindmore22
Copy link
Collaborator

milindmore22 commented Apr 23, 2021

Bug Description

AMP Settings screen is inaccessible with WP 4.9.x versions. due to polyfill js dependencies as old version required to attach it to global windows object.

This also brings the question of if we should drop support for older WP versions 4.9? it's been more than 2 years since Gutenberg is released.

The console error

Uncaught TypeError: Cannot read property 'i18n' of undefined
    at wp-api-fetch.js?ver=7645fa7ef83c5d94141bdac792ab796a:1
    at Object.2 (wp-api-fetch.js?ver=7645fa7ef83c5d94141bdac792ab796a:1)
    at r (wp-api-fetch.js?ver=7645fa7ef83c5d94141bdac792ab796a:1)
    at Object.48 (wp-api-fetch.js?ver=7645fa7ef83c5d94141bdac792ab796a:1)
    at r (wp-api-fetch.js?ver=7645fa7ef83c5d94141bdac792ab796a:1)
    at Module.<anonymous> (wp-api-fetch.js?ver=7645fa7ef83c5d94141bdac792ab796a:1)
    at Module.216 (wp-api-fetch.js?ver=7645fa7ef83c5d94141bdac792ab796a:1)
    at r (wp-api-fetch.js?ver=7645fa7ef83c5d94141bdac792ab796a:1)
    at Object.215 (wp-api-fetch.js?ver=7645fa7ef83c5d94141bdac792ab796a:1)
    at r (wp-api-fetch.js?ver=7645fa7ef83c5d94141bdac792ab796a:1)
admin.php?page=amp-options:81 

Uncaught ReferenceError: wp is not defined at admin.php?page=amp-options:81

Expected Behaviour

AMP Settings screen Works as expected with the WP 4.9

Steps to reproduce

  1. Setup WP 4.9 or you can use WP Downgrade Plugin and set up 4.9
  2. Install AMP if it's already not present.
  3. Visit the AMP settings screen.
  4. Open Browser Console and See error

Screenshots

image

Additional context

  • WordPress version: 4.9.x
  • Plugin version: 2.0.11
  • Gutenberg plugin version (if applicable): Nope we are going Classic
  • AMP plugin template mode: Transional Mode
  • PHP version: 7.4
  • OS: Mac OS
  • Browser: chrome
  • Device: Macbook Air

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

@milindmore22 milindmore22 added the Bug Something isn't working label Apr 23, 2021
@westonruter westonruter added this to the v2.1 milestone Apr 23, 2021
@delawski
Copy link
Collaborator

I've done some research today and found out that the Settings page stopped working on WordPress 4.9 after releasing AMP 2.0.5.

I'm almost certain it has something to do with #5461. Most likely I won't have time to look into this today, but it's on my to-do list for tomorrow.

@westonruter
Copy link
Member

@delawski This change may be the cause: 05d751a (via #5461).

@delawski
Copy link
Collaborator

@westonruter As @pierlon found out and fixed in #6119, the issue was caused by the fact that the wp-i18n package now depends on wp-hooks (see WordPress/gutenberg#27966). The PR is now ready for your review/QA and merge.

@westonruter
Copy link
Member

QA Passed

On 4.9, accessing the setting screen results in:

image

Upon upgrading to 2.1 on develop, no such error:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants