JannicBeck / undox

⎌ Redux Implementation of Undo/Redo based on storing actions instead of states.
MIT License
24 stars 5 forks source link

API proposal: merge undox argument into object. #42

Open Buggytheclown opened 3 years ago

Buggytheclown commented 3 years ago

If i want to pass limit config i need to add "initAction" and "comparator" explicitly or as undefined

undox(
  _counterReducer,
  { type: "undox/INIT" },
  (_) => false,
  {
    past: 2,
    future: Infinity
  }
)

I want to be able to pass only needed args, for example

undox(_counterReducer, {
  limit: {
    past: 2,
    future: Infinity,
  },
});
JannicBeck commented 3 years ago

I deliberately decided against this when I wrote this library, since I wanted to keep it simple and to the core. Where any additional features/use cases would be implemented as custom higher order reducers (at least this was the plan). That said, I definitely see your point, its unfortunate that the limit is the third argument now, but I did not want to break backwards compatibility for "styling" reasons ... Since the object would also break backwards compatibility it would have to be done in a major release which is not planned atm since I simply don't have enough feature requests to warrant that ...