The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update use-keyboard-shortcut.tsx
Tim Wilson5e493e2602bc
diff --git a/packages/ui/src/hooks/use-keyboard-shortcut.tsx b/packages/ui/src/hooks/use-keyboard-shortcut.tsxindex 3c6a5f82ff..e676c208e7 100644--- a/packages/ui/src/hooks/use-keyboard-shortcut.tsx+++ b/packages/ui/src/hooks/use-keyboard-shortcut.tsx@@ -73,16 +73,16 @@ export function useKeyboardShortcut((Array.isArray(l.key) ? l.key.includes(e.key) : l.key === e.key),);- if (matchingListeners.length) {- // Sort the listeners by priority- const topListener = stableSort(- matchingListeners,- (a, b) => (b.priority ?? 0) - (a.priority ?? 0),- ).slice(-1)[0];-- // Check if this is the top listener- if (topListener.id !== id) return;- }+ if (!matchingListeners.length) return;++ // Sort the listeners by priority+ const topListener = stableSort(+ matchingListeners,+ (a, b) => (b.priority ?? 0) - (a.priority ?? 0),+ ).slice(-1)[0];++ // Check if this is the top listener+ if (topListener.id !== id) return;e.preventDefault();callback(e);