Repository navigation
Conversation
| } | ||
| } | ||
|
|
||
| const filesRestored = new WeakSet<HTMLButtonElement>(); |
There was a problem hiding this comment.
This was needed because we kept the dropdown open, I think. Since the dropdown now closes on click, the user cannot double click. By the time they manage to open the menu and click again, it's probably done and the file is gone.
| filesRestored.add(menuItem); | ||
|
|
||
| try { | ||
| await showToast(async progress => { |
There was a problem hiding this comment.
showToast already acts as its own try/catch, with errors being shown in the toast itself. No need for an extra try/catch as long as everything is inside.
|
|
||
| export function registerHotkey(hotkey: string, action: VoidFunction | string): Deinit { | ||
| const element = typeof action === 'string' | ||
| ? <a hidden href={action} data-hotkey={hotkey}/> |
There was a problem hiding this comment.
I also added support for strings, but haven't found any use for it where it would simplify the code.
There was a problem hiding this comment.
What if we treat this string as a selector and do select(action).click()?
To emulate link behavior, just pass an action of () => location.assign(link).
There was a problem hiding this comment.
What if we treat this string as a selector and do
select(action).click()?
addHotkey already does that:
registerHotkey('ctrl-a', 'a[blah]') // Your suggestion
addHotkey(select('a[blah]'), 'ctrl-a') // Already-possible solutionTo emulate link behavior, just pass an action of
() => location.assign(link).
There's no substitute for real links (which can be handled by Turbo as well).
I do see two possible improvements here:
- make the two functions consistent (always accept "hotkey" first), or
- merge the two functions so
registerHotkeyaccepts an element passed as "action"
Picked from 1e1887a Too small a change to be a pull request
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'nextElementSibling')
at MutationObserver.cleanPrHeader
|
Will merge within an hour |


Uh oh!
There was an error while loading. Please reload this page.