From d44c72a720635f0b5fa8226162b5017642cb30fb Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Sun, 28 Sep 2025 17:30:07 +0100 Subject: [PATCH 1/3] Allow shortcuts hook to work if undefined --- apps/webapp/app/routes/admin._index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/webapp/app/routes/admin._index.tsx b/apps/webapp/app/routes/admin._index.tsx index 8da48339ac..aafb818002 100644 --- a/apps/webapp/app/routes/admin._index.tsx +++ b/apps/webapp/app/routes/admin._index.tsx @@ -138,13 +138,17 @@ export default function AdminDashboardRoute() {
- From c478836b916afcd5969480a7b2dcd32d2eb86061 Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Sun, 28 Sep 2025 17:30:42 +0100 Subject: [PATCH 2/3] Conditionally show shortcut button if only 1 result --- .../app/components/primitives/Buttons.tsx | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/apps/webapp/app/components/primitives/Buttons.tsx b/apps/webapp/app/components/primitives/Buttons.tsx index 6859608eef..9747b63b4d 100644 --- a/apps/webapp/app/components/primitives/Buttons.tsx +++ b/apps/webapp/app/components/primitives/Buttons.tsx @@ -298,19 +298,17 @@ export const Button = forwardRef( const innerRef = useRef(null); useImperativeHandle(ref, () => innerRef.current as HTMLButtonElement); - if (props.shortcut) { - useShortcutKeys({ - shortcut: props.shortcut, - action: (e) => { - if (innerRef.current) { - innerRef.current.click(); - e.preventDefault(); - e.stopPropagation(); - } - }, - disabled, - }); - } + useShortcutKeys({ + shortcut: props.shortcut, + action: (e) => { + if (innerRef.current) { + innerRef.current.click(); + e.preventDefault(); + e.stopPropagation(); + } + }, + disabled: disabled || !props.shortcut, + }); return (