Member-only story

Angular Isn’t Reactive Enough

There is a very frustrating bug that keeps appearing in Angular apps

Michael Pearson
Better Programming
5 min readMar 6, 2020

--

Photo by Lance Anderson on Unsplash.

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 to type=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.

--

--

Responses (4)

What are your thoughts?