Fix defaults() to always be static.

Review Request #13517 — Created Feb. 1, 2024 and submitted

Information

Review Board
master

Reviewers

We had a number of classes where defaults was not properly defined as
static. This broke when updating to the newer spina that fixes
prototypeAttrs inheritance.

  • Ran js-tests.
  • Audited the codebase for this and other inherited attributes that
    needed to be static.
Summary ID
Fix defaults() to always be static.
We had a number of classes where `defaults` was not properly defined as `static`. This broke when updating to the newer `spina` that fixes `prototypeAttrs` inheritance. Testing Done: - Ran js-tests. - Audited the codebase for this and other inherited attributes that needed to be static.
25d9d35c12bc4b97dfd3643dc93ecebb4698922f
Description From Last Updated

Missing Version Added.

chipx86chipx86

Missing docs.

chipx86chipx86
maubin
  1. Ship It!
  2. 
      
chipx86
  1. The new Spina changes up for review correct the problem that impacted the tests, which was that order of automerge and prototype attr operations was incorrect, causing state to be overridden.

    I've been thinking about what the most correct thing is for these sorts of methods going forward. At first glance, some of these may appear to be all about the construction of objects (such as defaults() or events()), but most are more instance-bound, and even those two aforementioned ones could refer to state from construction.

    I think the right way going forward is to keep these as prototype-bound methods. But I also think that we should move away from Backbone's duality of function/value for these, when it comes to actually implementing them.

    I'm playing around with some ideas there, but they basically center around using the existing attributes as hard-coded values, and having entirely new methods to use when you want to dynamically build a value (e.g. buildDefaults() and buildEvents()).

    And then utility methods for getting the right computed value (e.g., getDefaults() and getEvents()).

    This would mean we have fewer hacks to think about to get values where we need them and typed correctly.

  2. 
      
chipx86
  1. 
      
  2. Show all issues

    Missing Version Added.

  3. Show all issues

    Missing docs.

  4. 
      
david
Review request changed
Status:
Completed