-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
fix: hidden settings menu affects settings layout #7769
Changes from 6 commits
e394f7a
fa7c1ef
e85cbd7
c0c8f2d
6eaafce
3283c0d
1cf742e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,24 @@ import { AppHotkeyScope } from '../types/AppHotkeyScope'; | |
|
||
import { useSequenceHotkeys } from './useSequenceScopedHotkeys'; | ||
|
||
export const useGoToHotkeys = (key: Keys, location: string) => { | ||
type GoToHotkeysProps = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changing the API to take an object which is better from a dev XP as parameters are named when using the hook There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I fully agree, Object is way more easier to debug and use. I always to that :) |
||
key: Keys; | ||
location: string; | ||
preNavigateFunction?: () => void; | ||
}; | ||
|
||
export const useGoToHotkeys = ({ | ||
key, | ||
location, | ||
preNavigateFunction, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. passing a a preNavigationFunction to update the problematic state There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please explain me how this part is working? I mean we did avoid useEffect but how's it solving the problem? |
||
}: GoToHotkeysProps) => { | ||
const navigate = useNavigate(); | ||
|
||
useSequenceHotkeys( | ||
'g', | ||
key, | ||
() => { | ||
preNavigateFunction?.(); | ||
navigate(location); | ||
}, | ||
AppHotkeyScope.Goto, | ||
|
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.
another useEffect spotted :p