Member-only story
Angular Isn’t Reactive Enough
There is a very frustrating bug that keeps appearing in Angular apps
Notice the commonality between the following bugs:
- The unread message count is not updated when the user gets a new message.
- The background color is not updated when the user loads a previous configuration.
- The icon is not updated when the state of media changes.
EndDate
input is not disabled when the user changes the query parameter totype=duration
.- The user still only gets notifications for previous queues when they subscribe to a new queue.
What’s the commonality? All of them can be put into the formula “___ is not updated when ___.” In other words, “___ is not reacting to ___.”
Once you have seen enough of these frustrating bugs, you will begin to recognize them as just the same bug showing up in different places. The more event-driven and data-rich the app is, the more this bug shows up.
How do we get rid of this bug? By thinking reactively: If a feature is initially wired up reactively, any new event or behavior should seamlessly tie in and not have to manage existing behaviors all over again.