Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearing the action log #614

Closed
monfera opened this issue Dec 16, 2018 · 4 comments
Closed

Clearing the action log #614

monfera opened this issue Dec 16, 2018 · 4 comments

Comments

@monfera
Copy link

monfera commented Dec 16, 2018

I'm often interested only in the actions pertaining to the specific user interaction (click, drag&drop, menu etc.) and not the entire history since initial page load. When a user interaction can lead to multiple actions, it's super hard to know what the new actions are. So I'd like to be able to erase the action log, eg. with Ctrl-K, similar to how the dev console can be erased.

Having said that, I'm surprised it's not avaliable aready, given the level of convenience it'd bring, so maybe I'm doing something wrong. Admittedly I believe it's best if a user action leads to a single action for the store, which is almost like an unspoken redux principle, and I even agree with it, but sometimes one has to work with preexisting code, to be refactored later.

@zalmoxisus
Copy link
Owner

The difference with logs from dev console is that here we should also be able to recompute actions to get the exact state, and by excluding/erasing certain actions there could be an inconsistency. What we provide as an alternative is to just hide them (while they are still stored in the history). For browser extension add actionsBlacklist / actionsWhitelist or predicate option (see the API).

@monfera
Copy link
Author

monfera commented Dec 16, 2018

Thanks for the answer! Btw. I wasn't looking for excluding past actions in any sense other than just not viewing past actions that no longer matter to me, not sure where I gave that impression (maybe "erase the action log" should've been "hide/remove from the view the rendered rows of the action log").

I don't understand the part about inconsistency, or what functionality would be jeopardized by not showing old actions. (Or even, by not storing old actions - if I'm not interested in the history then there won't be functions requiring these past actions, unlike when filtering certain action types, maybe I'm overlooking something.) Even if there's functionality tied to keeping around old actions (or specifically, all the states associated with these old actions, going beyond Redux itself, eg. undoing actions which afaik Redux Dev Tools doesn't support afaik) my suggestion was about simply not showing actions prior to a specific action, which feels like a view question.

The way Redux works is conducive to modeling it as a starting state and a subsequent series of actions that make new states, and what the starting state is, is arbitrary. Especially when it comes to debugging - coders can decide that they're simply not interested in viewing anything prior to whatever action. Even the name "Redux" may have come from it, it's basically a reducer.

The otherwise useful functionality of hiding specific action types is orthogonal to the original suggestion, although seems analogous. If that's useful, possible and allowed, then eliding historical actions could be as well.

Btw. please don't interpret any of this other than a feature suggestion simply based on what I'd find useful and analogous with similar Ctrl-K things in Dev Console and console logs, these are well used features for the same reason: allowing the developer to focus on what matters.

@zalmoxisus
Copy link
Owner

zalmoxisus commented Dec 16, 2018

Btw. please don't interpret any of this other than a feature suggestion simply based on what I'd find useful and analogous with similar Ctrl-K things in Dev Console and console logs

Ah, sorry, that "clear the console" shortcut is identical with our "Commit" button, and that's not only hiding them from the view (monitor component). It's also freeing the memory of that actions history and related states, that's why it's called "Commit" (not "clear"), because it's squashing them into one INIT action with the last state till there.

Thought you want to exclude only specific actions, for which the mentioned options should do the trick.

undoing actions which afaik Redux Dev Tools doesn't support afaik

That's supported. In the Inspector monitor, there's "Skip" button for that. For Log Monitor you can click on the action to "undo" it. Here's an explanation of all buttons. The documentation is still poor and lacks a lot of features description.

@monfera
Copy link
Author

monfera commented Dec 16, 2018

Ah, sorry, that "clear the console" shortcut is identical with our "Commit" button, and that's not only hiding them from the view (monitor component). It's also freeing the memory of that actions history and related states, that's why it's called "Commit" (not "clear"), because it's squashing them into one INIT action with the last state till there.

Awesome, thanks @zalmoxisus, this is just as fine for my use!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants