-
Notifications
You must be signed in to change notification settings - Fork 560
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
State Refactor: Move note info into Redux #1896
Conversation
// showNavigation: { $set: false }, | ||
// editingTags: { $set: false }, | ||
} | ||
|
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.
Again, I believe we don't need to handle these cases explicitly, but I hope someone can verify that
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.
we can verify it!
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.
in testing I can see that it's more of a choice to change the behavior or keep it. if we take this out then the note info stays open when we flip the navigation panel.
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.
I haven't been able to make that happen, what are the steps? If I open note info, there's no way to open the navigation panel (any click is an "outside click" that closes the note info).
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.
From Slack: "Use the keyboard shortcut Cmd + t and flip the tag drawer/nav panel open and closed"
I tried this and it does seem to close the info panel, so I'm gonna say.. it's fine.
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.
sorry. I should have clarified that - obviously this code closes the note info panel when toggling the navigation panel. however, when I removed the case 'App.toggleNavigation'
as it seemed like you were suggesting would be possible, then the note info would stay open on navigation.
That is, this is an answer to the question "can we skip handling these cases explicitly" and that answer is "if we want and decide to."
Lookin' good @codebykat - I hope you found the examples and documentation helpful. Left a few notes which I think might make your job easier. If not, don't hesitate to reach out and challenge or ask. |
Looks great, I didn't see anything outside of what Dennis came up with! |
Does look like you have a linting error. https://circleci.com/gh/Automattic/simplenote-electron/9628?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link |
Cool, that all makes sense! Fixed some nits and up for review again. Thanks @dmsnell :) One thing is I couldn't figure out how to remove the dispatch argument from MapDispatchToProps in It works in There is some other stuff that needs to be moved to Redux in |
735a7e0
to
710d0e5
Compare
Rebased and tested both this and the edit mode toggle (which was entangled). |
299cce8
to
91e6aa0
Compare
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.
Seems like a good merge and I don't think we need to worry about asking whether we should handle the App.toggleNavigation
action or not. As-is the code matches the existing behavior so that's an easier call to make when refactoring than whether we should change behavior.
Fix
This moves the
showNoteInfo
boolean and associated toggles into Redux state.Test
Review
Code review: Please check to make sure I did this right and didn't miss anything! I used #1881 as an example.
I moved
showNoteInfo
fromappState.showNoteInfo
tostate.ui.showNoteInfo
, added new actions and a new reducer, and removed the legacy action.In the reducer I am definitely eyeing
VisiblePanes
as potentially a more logical place to put this (along with the Navigation, see below) but this PR seemed complicated enough already so I decided to stick with a statewide boolean for now.Another thing of note is that the former incarnation of this action also sets
showNavigation
andeditingTags
tofalse
when the notes panel is shown. I was unable to figure out what edge cases that was meant to handle, so I'm not sure if it is still necessary, and it seems it will be somewhat complicated without growing the PR to also move those two state variables into Redux. (See my line comments on the diff below.)