Fix: Type error in requestFromUrl
#29043
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using
requestFromUrl()
in #29026 we noticed errors being thrownfrom within
waitForData()
. Investigation revealed this basic typeerror that could have been caught by a language and compiler before it
was pushed to production. Yay JS.
This wasn't detected because this function isn't yet being used and we
weren't sure how to test it. Thankfully our fail-fast methodology
prevented this from appearing to our customers.
Testing
Checkout #29026, uncomment the lines in
editor/controller.js
which add the Jetpack translation files, and load/gutenberg
with a non-English locale selected for your account.In that branch you should discover an error in the dev console after the page load about an unwrapped exception in the promise, it will show
{ gutenberg, jetpack }
…Merge this branch into that PR and reload the page. This time it shouldn't produce that error. Note: I still found an error appear from the
/media
endpoint but I believe that is unrelated to this code as it comes from somewhere else.