rodux icon indicating copy to clipboard operation
rodux copied to clipboard

Deprecate 'changed' and introduce new store update signal

Open LPGhatguy opened this issue 7 years ago • 2 comments

When I built the first version of Rodux, the best way to respond to changes outside of something like React/Roact wasn't very well understood.

I think that we understand now that the best way to respond to changes in the Rodux store is to keep the last value you had, and on update, compare the new store state with it. In short, you should ignore the second argument of the changed event!

This issue covers two gripes:

  • I want to remove the second value passed by the changed signal because it's a bad practice
  • I want to fix the naming of the changed signal to indicate that it's a signal (onUpdate maybe?)

LPGhatguy avatar May 22 '18 23:05 LPGhatguy

We could also (re)introduce the old subscription approach, a method called subscribe that returns a disconnection function. This might be the simplest approach, and avoids requiring an additional API (a signal object).

LPGhatguy avatar Jun 14 '18 00:06 LPGhatguy

Subscriptions seem like a more intuitive mindset to the places I use .changed for.

Kampfkarren avatar Jul 29 '18 10:07 Kampfkarren