Fix the diff viewer JS with modern babel.
Review Request #12102 — Created March 6, 2022 and submitted
Information | |
---|---|
david | |
Review Board | |
release-5.0.x | |
Reviewers | |
reviewboard | |
This fixes an error when loading the diff viewer on release-5.0.x (and
master). Devtools were showing an error that theDiffViewerPage
constructor wasn't a constructor. The issue here seems to be a change in
the way that the newer babel deals with function shorthands inside of an
object. Whereas before it was translatingconstructor() {...}
to
constructor: function constructor() {...}
, it now leaves them as-is.
In most cases this works fine, but it seems like browsers are treating
theconstructor
name specially (since it's a reserved word and used
for classes). Explicitly using the older object attribute syntax fixes
this.
Created a review request with a diff and was able to successfully load
the diff viewer page.
Summary | |
---|---|