Ramonda

RMD040 — More than one @ShouldUpdateOnPropsChange on one class

@ShouldUpdateOnPropsChange((_self, previous, next) => next.v !== previous.v)   // this one decides
@ShouldUpdateOnPropsChange(() => false)                                       // never consulted
class Gated extends Component<{ v: number }> { render() { … } }

There can only be one answer to "take these props?", so one of them decides and the others never run — a gate that looks present and is not.

The one that decides is the HIGHEST, which reads backwards. One rule covers this and RMD032: the declaration applied last is the one that stands. @ShouldUpdateOnPropsChange is a class decorator and class decorators apply bottom-up, so the lower declaration writes the rule and the upper one overwrites it. A member decorator initialises top to bottom, so there it is the lowest — the same rule, the opposite line.

Remove the extras and combine their conditions into one callback.

A subclass declaring its own is not this. That is an override — the ordinary way to specialise the rule — and it is silent. This fires only for two applications on the same class.

Next