Skip to content

Settings screen lacks JS error handling #6230

Closed
@westonruter

Description

@westonruter

Bug Description

When on WordPress 5.3.8, accessing the AMP Settings screen with AMP v2.1.1 results in a blank settings screen with a JS error in the console:

rtl.js:84 Uncaught TypeError: Object(...) is not a function
    at rtl.js:84
    at Module../node_modules/@wordpress/components/build-module/select-control/styles/select-control-styles.js (select-control-styles.js:59)
    at __webpack_require__ (bootstrap:19)
    at Module../node_modules/@wordpress/components/build-module/select-control/index.js (index.js:1)
    at __webpack_require__ (bootstrap:19)
    at Module../node_modules/@wordpress/components/build-module/custom-gradient-picker/index.js (index.js:1)
    at __webpack_require__ (bootstrap:19)
    at Module../node_modules/@wordpress/components/build-module/gradient-picker/index.js (index.js:1)
    at __webpack_require__ (bootstrap:19)
    at Module../node_modules/@wordpress/components/build-module/index.js (index.js:1)
(anonymous) @ rtl.js:84
./node_modules/@wordpress/components/build-module/select-control/styles/select-control-styles.js @ select-control-styles.js:59
__webpack_require__ @ bootstrap:19
./node_modules/@wordpress/components/build-module/select-control/index.js @ index.js:1
__webpack_require__ @ bootstrap:19
./node_modules/@wordpress/components/build-module/custom-gradient-picker/index.js @ index.js:1
__webpack_require__ @ bootstrap:19
./node_modules/@wordpress/components/build-module/gradient-picker/index.js @ index.js:1
__webpack_require__ @ bootstrap:19
./node_modules/@wordpress/components/build-module/index.js @ index.js:1
__webpack_require__ @ bootstrap:19
./assets/src/components/loading/index.js @ amp-settings.js?ver=6b389aa5fc09f404606dae2886ade7ad:1183
__webpack_require__ @ bootstrap:19
(anonymous) @ amp-settings.js?ver=6b389aa5fc09f404606dae2886ade7ad:4267
./assets/src/settings-page/index.js @ amp-settings.js?ver=6b389aa5fc09f404606dae2886ade7ad:4476
__webpack_require__ @ bootstrap:19
2 @ module.js:22
__webpack_require__ @ bootstrap:19
(anonymous) @ bootstrap:83
(anonymous) @ bootstrap:83

The error here is originating our entrypoint. We should wrap this with a try/catch block to show an error message with the details, including a link to submit a support topic with the associated stack trace.

Note that this specific issue with WordPress 5.3.8 is fixed by #6225, but we should have such error handling regardless.

Expected Behaviour

Errors should not cause a blank screen.

Steps to reproduce

  1. Install WordPress 5.3.8.
  2. Activate AMP v2.1.1
  3. Access the AMP Settings screen.

Screenshots

image


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