• 
      

    Fix the diff viewer JS with modern babel.

    Review Request #12102 — Created March 6, 2022 and submitted

    Information

    Review Board
    release-5.0.x

    Reviewers

    This fixes an error when loading the diff viewer on release-5.0.x (and
    master). Devtools were showing an error that the DiffViewerPage
    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 translating constructor() {...} to
    constructor: function constructor() {...}, it now leaves them as-is.
    In most cases this works fine, but it seems like browsers are treating
    the constructor 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 ID
    Fix the diff viewer JS with modern babel.
    This fixes an error when loading the diff viewer on release-5.0.x (and master). Devtools were showing an error that the `DiffViewerPage` 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 translating `constructor() {...}` to `constructor: function constructor() {...}`, it now leaves them as-is. In most cases this works fine, but it seems like browsers are treating the `constructor` name specially (since it's a reserved word and used for classes). Explicitly using the older object attribute syntax fixes this. Testing Done: Created a review request with a diff and was able to successfully load the diff viewer page.
    f38281b289888ace814363e0b562102270261d9f
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-5.0.x (2d2fa56)