-
Notifications
You must be signed in to change notification settings - Fork 67
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
Added shift toggle #47
Conversation
@@ -72,6 +72,10 @@ export default class LogMonitor extends Component { | |||
|
|||
shouldComponentUpdate = shouldPureComponentUpdate; | |||
|
|||
state = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use monitorState
and reducers
for that? We already have a reducer tracking current scroll top, for example. Local state will get erased on reload, but with persistState()
, monitorState
will not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh you're totally right. Can't believe i didn't notice the reducer.js and action.js..
Do you mind providing a GIF showing how it works? |
Hmm, i was using redux-devtools-extension and realised that its not using the default instrument. In that case, the reducer is not in used. Any thoughts about it? |
We use default instrument in |
@@ -160,7 +161,7 @@ export default class LogMonitor extends Component { | |||
|
|||
handleToggleConsecutiveAction(id) { | |||
const { consecutiveToggleStartId } = this.props.monitorState; | |||
if (consecutiveToggleStartId !== null) { | |||
if (consecutiveToggleStartId > -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works only first time, while consecutiveToggleStartId
is undefined
and the condition is not satisfied. Next time consecutiveToggleStartId
will be set to null
and null > -1
. So it will be always interpreted as a starting point, and there won't be possible to set another start point than null
anymore.
Why not just to have if (consecutiveToggleStartId)
? It will also prevent toggling the first INIT state. I tried and this fixes the issue.
@khankuan, I'd like to merge this. If you could find time to fix the conflicts, I'll review it and will add support for monitor reducers in the extension. Also, would be nice to identify actions to be toggled in some other way. Maybe an interrupted or flashing line? |
@zalmoxisus cool :) I've fixed the merge conflicts. However, I would like to get some help on the best way to run and test the monitor visually. |
I guess the easier way would be to have an example here. For now you can:
|
Hey, i've updated the branch and tested. Used opacity for selected state instead. I'm interested in the flashing line, would it required |
@khankuan, css animation with inline styles is a pain. I think we could just keep your implementation with opacity, marking that it's still not applied. Maybe you have any other ideas of showing that the action is still in process? |
@khankuan, looks great, thanks. There's still an issue here to be addressed. |
Hmm I dont see it. Is the review in draft mode? |
@khankuan, weird :) The reducer works ok, but, when having other actions dispatched meantime, the selection is lost. Returning I'd suggest to dismiss the selection only when regular Another case is when the selected action got removed (due to commiting, reseting, reaching maxAge...), for that we shouldn't take it into consideration just by checking if it's present when making the second shift toggle. |
Ah interesting! Do you think we can use a method similar to redux-devtools-log-monitor/src/LogMonitor.js Line 112 in 9d87092
|
@khankuan it would solve just a part of the problem. I think we should just return the previous value instead of |
Oh yes definitely meant that. But more importantly, would the keyup event method be the best way? |
@khankuan, no, listening to keyup events wouldn't be a solution, at least because actions can be removed due to reaching maxAge. Better and simpler is just to dismiss it (set to |
… valid to dispatch setActionsActive
@zalmoxisus sorry for the delay, updated accordingly here: 11e698c |
@khankuan, no worries, thanks a lot for the changes. I see 2 issues here:
|
Hmm, for 1, would there be any consequence of preserving via store state? For 2, I'm trying to understand it a little more. I was expecting the ux flow to be:
|
It just throws as you try to access
First time it will work as expected, then you'll not be able to select the first action anymore, as it is already selected ( |
Hey @khankuan, I'm merging this, will add the missing part in another PR. Thanks a lot for the contribution! |
…ft toggling Related to #47 (comment) nt-263669403
@zalmoxisus thanks for maintaining this project :) |
No description provided.