rodux icon indicating copy to clipboard operation
rodux copied to clipboard

Expose store `ACTION_LOG_LENGTH` as a user-settable param, and add a `:clearLog` method to the store

Open sayhisam1 opened this issue 4 years ago • 0 comments

At times, it is useful to know what actions were successfully applied to a store (e.g. to fire highly specific listeners that correspond to specific actions). At present, however, the action log is very limited and of fixed length. It would be useful if there was a way to change the log length, and also clear the log if needed.

sayhisam1 avatar Jun 07 '21 07:06 sayhisam1

Each item can be implemented in the following (correct me if I'm wrong):

For ACTION_LOG_LENGTH:

  1. ACTION_LOG_LENGTH is no longer a localized variable and becomes a value in the Store table, the one returned in the module. The user can set it with Store.ACTION_LOG_LENGTH = X, or with a setter function, Store.setActionLogLength`.
  2. It becomes unique to each Store object. The user sets it like Store:setActionLogLength() / Store.setActionLogLength(store), and self._actionLogLength becomes a thing.

For Store:clearLog() / Store.clearLog(store):

  1. A function Store.clearLog that sets self._actionLog to an empty table.

I am unfamiliar with Rodux's ecosystem, so there might be another step in clearing the log, such as cleaning up connections.

recanman avatar Oct 07 '22 17:10 recanman