Closed julianpoemp closed 3 years ago
While the user does changes to the data (manual processing) the undo & redo shoud be enabled. As soon as the user triggers the automatic processing, he shouldn't be able to do undo & redo as long as the automatic processing is running.
You can already prevent the user from performing undo/redo by e.g. disabling the corresponding buttons/key combinations. Otherwise you could also split undo/redo actions into two parts (one for triggering, one for performing) and funnel them through an effect that filters the latter based on your criteria.
But the problem is, that the automatic process uses the same actions that are allowed to be redone/undone.
As you correctly pointed out, that is the actual problem. Why not introduce separate actions for the automated processing and let them be ignored by ngrx-wieder?
Watch out though, the latest step in history probably won't make sense when applied on top of the result of your automated processing. As far as I understood, you'll probably have to undo the automated processing as well if you want to keep the history.
As you correctly pointed out, that is the actual problem. Why not introduce separate actions for the automated processing and let them be ignored by ngrx-wieder?
Your're right... I think this solution is more beautiful than mine. But if I do it that way I have to make more changes than simply introducing few, new actions. I'll think about it, thanks!
Description of the feature
As soon as undo & redo is disabled, the history stops growing and the
UNDO
andREDO
actions do not have any effect. After the undo&redo was re-enabled the undo function reverts the state to the state before the deactivation.Problem
There are situations where you want to enable/disable undo&redo. For example: I'm currently working on an app that allows an combination of manual and automatic processing of data. While the user does changes to the data (manual processing) the undo & redo shoud be enabled. As soon as the user triggers the automatic processing, he shouldn't be able to do undo & redo as long as the automatic processing is running.
Workaround
I'm currently using a workaround: As long as undo&redo is disabled, these actions are not triggered. But the problem is, that the automatic process uses the same actions that are allowed to be redone/undone. That means the history keeps growing although it shouldn't. That's why I call the
CLEAR
action after each time an allowed-action type was called while the undo & redo is disabled. The disadvantage of this workaround is that I lost the whole history.Suggestion
It would be nice if there are any actions to enable/disable redo & undo. For example: 'ENABLE' and 'DISABLE' Does this makes sense?