The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore(studio): show active shortcuts in reference sheet (#45614)
Danny Whitef32977f04d27
diff --git a/apps/studio/components/interfaces/DatabaseNavShortcuts.tsx b/apps/studio/components/interfaces/DatabaseNavShortcuts.tsxdeleted file mode 100644index 1b524aeaa73..00000000000--- a/apps/studio/components/interfaces/DatabaseNavShortcuts.tsx+++ /dev/null@@ -1,96 +0,0 @@-import { useRouter } from 'next/router'-import { useCallback, useMemo } from 'react'--import { useGenerateDatabaseMenu } from '@/components/layouts/DatabaseLayout/DatabaseMenu.utils'-import { SHORTCUT_IDS, type ShortcutId } from '@/state/shortcuts/registry'-import { useShortcut } from '@/state/shortcuts/useShortcut'--export const DatabaseNavShortcuts = () => {- const router = useRouter()- const groups = useGenerateDatabaseMenu()-- const urlByShortcut = useMemo(() => {- const map = new Map<ShortcutId, string>()- for (const group of groups) {- for (const item of group.items) {- if (item.shortcutId && item.url) map.set(item.shortcutId, item.url)- }- }- return map- }, [groups])-- const navigate = useCallback(- (id: ShortcutId) => {- const url = urlByShortcut.get(id)- if (url) router.push(url)- },- [router, urlByShortcut]- )-- useShortcut(SHORTCUT_IDS.NAV_DATABASE_TABLES, () => navigate(SHORTCUT_IDS.NAV_DATABASE_TABLES), {- enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_TABLES),- })- useShortcut(- SHORTCUT_IDS.NAV_DATABASE_FUNCTIONS,- () => navigate(SHORTCUT_IDS.NAV_DATABASE_FUNCTIONS),- { enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_FUNCTIONS) }- )- useShortcut(- SHORTCUT_IDS.NAV_DATABASE_TRIGGERS,- () => navigate(SHORTCUT_IDS.NAV_DATABASE_TRIGGERS),- { enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_TRIGGERS) }- )- useShortcut(- SHORTCUT_IDS.NAV_DATABASE_INDEXES,- () => navigate(SHORTCUT_IDS.NAV_DATABASE_INDEXES),- { enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_INDEXES) }- )- useShortcut(- SHORTCUT_IDS.NAV_DATABASE_EXTENSIONS,- () => navigate(SHORTCUT_IDS.NAV_DATABASE_EXTENSIONS),- { enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_EXTENSIONS) }- )- useShortcut(- SHORTCUT_IDS.NAV_DATABASE_SCHEMA_VISUALIZER,- () => navigate(SHORTCUT_IDS.NAV_DATABASE_SCHEMA_VISUALIZER),- { enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_SCHEMA_VISUALIZER) }- )- useShortcut(SHORTCUT_IDS.NAV_DATABASE_ROLES, () => navigate(SHORTCUT_IDS.NAV_DATABASE_ROLES), {- enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_ROLES),- })- useShortcut(- SHORTCUT_IDS.NAV_DATABASE_BACKUPS,- () => navigate(SHORTCUT_IDS.NAV_DATABASE_BACKUPS),- { enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_BACKUPS) }- )- useShortcut(- SHORTCUT_IDS.NAV_DATABASE_MIGRATIONS,- () => navigate(SHORTCUT_IDS.NAV_DATABASE_MIGRATIONS),- { enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_MIGRATIONS) }- )- useShortcut(SHORTCUT_IDS.NAV_DATABASE_TYPES, () => navigate(SHORTCUT_IDS.NAV_DATABASE_TYPES), {- enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_TYPES),- })- useShortcut(- SHORTCUT_IDS.NAV_DATABASE_PUBLICATIONS,- () => navigate(SHORTCUT_IDS.NAV_DATABASE_PUBLICATIONS),- { enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_PUBLICATIONS) }- )- useShortcut(- SHORTCUT_IDS.NAV_DATABASE_COLUMN_PRIVILEGES,- () => navigate(SHORTCUT_IDS.NAV_DATABASE_COLUMN_PRIVILEGES),- { enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_COLUMN_PRIVILEGES) }- )- useShortcut(- SHORTCUT_IDS.NAV_DATABASE_SETTINGS,- () => navigate(SHORTCUT_IDS.NAV_DATABASE_SETTINGS),- { enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_SETTINGS) }- )- useShortcut(- SHORTCUT_IDS.NAV_DATABASE_REPLICATION,- () => navigate(SHORTCUT_IDS.NAV_DATABASE_REPLICATION),- { enabled: urlByShortcut.has(SHORTCUT_IDS.NAV_DATABASE_REPLICATION) }- )-- return null-}diff --git a/apps/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx b/apps/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsxindex 7365cd2c3c3..ccdb26b4e5d 100644--- a/apps/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx+++ b/apps/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx@@ -3,8 +3,8 @@ import type { PropsWithChildren } from 'react'import { ProjectLayout } from '../ProjectLayout'import { useGenerateDatabaseMenu } from './DatabaseMenu.utils'-import { DatabaseNavShortcuts } from '@/components/interfaces/DatabaseNavShortcuts'import { ProductMenu } from '@/components/ui/ProductMenu'+import { ProductMenuShortcuts } from '@/components/ui/ProductMenu/ProductMenuShortcuts'import { withAuth } from '@/hooks/misc/withAuth'export interface DatabaseLayoutProps {@@ -20,14 +20,18 @@ export const DatabaseProductMenu = () => {}const DatabaseLayout = ({ children, title }: PropsWithChildren<DatabaseLayoutProps>) => {+ const router = useRouter()+ const page = router.pathname.split('/')[4]+ const menu = useGenerateDatabaseMenu()+return (<ProjectLayoutproduct="Database"browserTitle={{ section: title }}- productMenu={<DatabaseProductMenu />}+ productMenu={<ProductMenu page={page} menu={menu} />}isBlocking={false}>- <DatabaseNavShortcuts />+ <ProductMenuShortcuts menu={menu} />{children}</ProjectLayout>)diff --git a/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.test.tsx b/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.test.tsxindex 9f52cba6611..433a5a3cd4d 100644--- a/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.test.tsx+++ b/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.test.tsx@@ -1,16 +1,71 @@+import type { HotkeyRegistrationView, SequenceRegistrationView } from '@tanstack/react-hotkeys'import { screen } from '@testing-library/react'import userEvent from '@testing-library/user-event'-import { describe, expect, it, vi } from 'vitest'+import { beforeEach, describe, expect, it, vi } from 'vitest'import { ShortcutsReferenceSheet } from './ShortcutsReferenceSheet'-import { SHORTCUT_DEFINITIONS } from '@/state/shortcuts/registry'+import { SHORTCUT_DEFINITIONS, SHORTCUT_IDS, type ShortcutId } from '@/state/shortcuts/registry'+import type { ShortcutHotkeyMeta } from '@/state/shortcuts/useShortcut'import { customRender } from '@/tests/lib/custom-render'-const NAVIGATION_LABELS = Object.values(SHORTCUT_DEFINITIONS)- .filter((definition) => definition.id.startsWith('nav.'))- .map((definition) => definition.label)+const { mockUseHotkeyRegistrations } = vi.hoisted(() => ({+ mockUseHotkeyRegistrations:+ vi.fn<() => { hotkeys: HotkeyRegistrationView[]; sequences: SequenceRegistrationView[] }>(),+}))++vi.mock('@tanstack/react-hotkeys', async () => {+ const actual =+ await vi.importActual<typeof import('@tanstack/react-hotkeys')>('@tanstack/react-hotkeys')+ return {+ ...actual,+ useHotkeyRegistrations: mockUseHotkeyRegistrations,+ }+})++const ACTIVE_SHORTCUT_IDS = [+ SHORTCUT_IDS.COMMAND_MENU_OPEN,+ SHORTCUT_IDS.NAV_HOME,+] satisfies ShortcutId[]++const ACTIVE_DATABASE_SHORTCUT_IDS = [+ ...ACTIVE_SHORTCUT_IDS,+ SHORTCUT_IDS.NAV_DATABASE_TABLES,+] satisfies ShortcutId[]++let sequenceIdCounter = 0++const buildSequenceRegistration = (id: ShortcutId): SequenceRegistrationView => {+ const definition = SHORTCUT_DEFINITIONS[id]+ const meta: ShortcutHotkeyMeta = {+ id: definition.id,+ name: definition.label,+ referenceGroup: definition.referenceGroup,+ }++ return {+ id: `sequence_${++sequenceIdCounter}`,+ sequence: definition.sequence,+ options: {+ enabled: true,+ meta,+ },+ target: document,+ triggerCount: 0,+ hasFired: false,+ matchedStepCount: 0,+ partialMatchLastKeyTime: 0,+ }+}-const renderShortcutsReferenceSheet = () => {+const seedRegistrations = (ids: ShortcutId[]) => {+ mockUseHotkeyRegistrations.mockReturnValue({+ hotkeys: [],+ sequences: ids.map(buildSequenceRegistration),+ })+}++const renderShortcutsReferenceSheet = (ids: ShortcutId[] = ACTIVE_SHORTCUT_IDS) => {+ seedRegistrations(ids)const onOpenChange = vi.fn()customRender(<ShortcutsReferenceSheet open onOpenChange={onOpenChange} />)@@ -19,6 +74,12 @@ const renderShortcutsReferenceSheet = () => {}describe('ShortcutsReferenceSheet', () => {+ beforeEach(() => {+ sequenceIdCounter = 0+ mockUseHotkeyRegistrations.mockReset()+ mockUseHotkeyRegistrations.mockReturnValue({ hotkeys: [], sequences: [] })+ })+it('renders the grouped shortcut list by default', async () => {renderShortcutsReferenceSheet()@@ -26,11 +87,13 @@ describe('ShortcutsReferenceSheet', () => {expect(screen.getByLabelText('Search shortcuts')).toBeInTheDocument()expect(screen.getByText('Command Menu')).toBeInTheDocument()expect(screen.getByText('Navigation')).toBeInTheDocument()+ expect(screen.queryByText('Global Navigation')).not.toBeInTheDocument()+ expect(screen.queryByText('Database Navigation')).not.toBeInTheDocument()expect(screen.getByText('Open command menu')).toBeInTheDocument()expect(screen.getByText('Go to Project Overview')).toBeInTheDocument()})- it('shows every shortcut in a group when the group label matches the search', async () => {+ it('shows only active shortcuts in a group when the group label matches the search', async () => {const user = userEvent.setup()renderShortcutsReferenceSheet()@@ -38,11 +101,9 @@ describe('ShortcutsReferenceSheet', () => {await user.type(screen.getByLabelText('Search shortcuts'), 'navigation')expect(screen.getByText('Navigation')).toBeInTheDocument()+ expect(screen.getByText('Go to Project Overview')).toBeInTheDocument()expect(screen.queryByText('Command Menu')).not.toBeInTheDocument()-- for (const label of NAVIGATION_LABELS) {- expect(screen.getByText(label)).toBeInTheDocument()- }+ expect(screen.queryByText('Go to Database')).not.toBeInTheDocument()})it('keeps the parent group header when only an item label matches', async () => {@@ -50,14 +111,50 @@ describe('ShortcutsReferenceSheet', () => {renderShortcutsReferenceSheet()- await user.type(screen.getByLabelText('Search shortcuts'), 'Go to Organization Integrations')+ await user.type(screen.getByLabelText('Search shortcuts'), 'Go to Project Overview')expect(screen.getByText('Navigation')).toBeInTheDocument()- expect(screen.getByText('Go to Organization Integrations')).toBeInTheDocument()- expect(screen.queryByText('Go to Logs')).not.toBeInTheDocument()+ expect(screen.getByText('Go to Project Overview')).toBeInTheDocument()+ expect(screen.queryByText('Open command menu')).not.toBeInTheDocument()expect(screen.queryByText('Command Menu')).not.toBeInTheDocument()})+ it('shows the database navigation section when database shortcuts are active', async () => {+ renderShortcutsReferenceSheet(ACTIVE_DATABASE_SHORTCUT_IDS)++ expect(await screen.findByText('Global Navigation')).toBeInTheDocument()+ expect(screen.getByText('Database Navigation')).toBeInTheDocument()+ expect(screen.queryByText(/^Navigation$/)).not.toBeInTheDocument()+ expect(screen.getByText('Go to Tables')).toBeInTheDocument()+ })++ it('does not show inactive database shortcuts in search results', async () => {+ const user = userEvent.setup()++ renderShortcutsReferenceSheet()++ await user.type(screen.getByLabelText('Search shortcuts'), 'Go to Tables')++ expect(screen.getByText('No matching shortcuts found')).toBeInTheDocument()+ expect(screen.queryByText('Database Navigation')).not.toBeInTheDocument()+ })++ it('hides shortcuts whose registration is soft-disabled', async () => {+ sequenceIdCounter = 0+ const enabled = buildSequenceRegistration(SHORTCUT_IDS.COMMAND_MENU_OPEN)+ const disabled = buildSequenceRegistration(SHORTCUT_IDS.NAV_HOME)+ disabled.options = { ...disabled.options, enabled: false }+ mockUseHotkeyRegistrations.mockReturnValue({+ hotkeys: [],+ sequences: [enabled, disabled],+ })++ customRender(<ShortcutsReferenceSheet open onOpenChange={vi.fn()} />)++ expect(await screen.findByText('Open command menu')).toBeInTheDocument()+ expect(screen.queryByText('Go to Project Overview')).not.toBeInTheDocument()+ })+it('shows a clear button when searching and resets the list when clicked', async () => {const user = userEvent.setup()diff --git a/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.tsx b/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.tsxindex 3e965208fa4..3eb2dbffe20 100644--- a/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.tsx+++ b/apps/studio/components/ui/GlobalShortcuts/ShortcutsReferenceSheet.tsx@@ -1,5 +1,6 @@+import { useHotkeyRegistrations, type SequenceRegistrationView } from '@tanstack/react-hotkeys'import { CircleX } from 'lucide-react'-import { Fragment, useEffect, useState } from 'react'+import { Fragment, useMemo, useState } from 'react'import {Button,KeyboardShortcut,@@ -13,21 +14,33 @@ import {import { Input } from 'ui-patterns/DataInputs/Input'import { hotkeyToKeys } from '@/state/shortcuts/formatShortcut'-import { SHORTCUT_DEFINITIONS } from '@/state/shortcuts/registry'-import type { ShortcutDefinition } from '@/state/shortcuts/types'+import {+ SHORTCUT_REFERENCE_GROUP_LABELS,+ SHORTCUT_REFERENCE_GROUP_ORDER,+ SHORTCUT_REFERENCE_GROUPS,+} from '@/state/shortcuts/referenceGroups'+import type { ShortcutHotkeyMeta } from '@/state/shortcuts/useShortcut'interface ShortcutsReferenceSheetProps {open: booleanonOpenChange: (open: boolean) => void}+interface ActiveShortcutDefinition {+ id: string+ label: string+ sequence: string[]+ referenceGroup?: string+}+interface ShortcutGroup {group: stringlabel: string- definitions: ShortcutDefinition[]+ definitions: ActiveShortcutDefinition[]}const GROUP_LABELS: Record<string, string> = {+ ...SHORTCUT_REFERENCE_GROUP_LABELS,'action-bar': 'Actions','ai-assistant': 'AI Assistant','command-menu': 'Command Menu',@@ -43,35 +56,55 @@ const GROUP_LABELS: Record<string, string> = {'unified-logs': 'Logs',}-const GROUP_ORDER = [- 'command-menu',- 'shortcuts',- 'nav',- 'ai-assistant',- 'inline-editor',- 'results',- 'data-table',- 'table-editor',- 'schema-visualizer',- 'list-page',- 'action-bar',- 'operation-queue',- 'unified-logs',-]-const getGroupOrder = (group: string) => {- const index = GROUP_ORDER.indexOf(group)- return index === -1 ? GROUP_ORDER.length : index+ const index = SHORTCUT_REFERENCE_GROUP_ORDER.indexOf(group)+ return index === -1 ? SHORTCUT_REFERENCE_GROUP_ORDER.length : index}const getGroupLabel = (group: string) => GROUP_LABELS[group] ?? group+const isScopedNavigationGroup = (group: string) =>+ group.startsWith('navigation.') && group !== SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL+const normalizeSearchValue = (value: string) => value.trim().toLowerCase()-const groupDefinitions = (): ShortcutGroup[] => {- const grouped = Object.values(SHORTCUT_DEFINITIONS).reduce<Record<string, ShortcutDefinition[]>>(+const toActiveDefinition = (+ registration: SequenceRegistrationView+): ActiveShortcutDefinition | null => {+ const meta = registration.options.meta as ShortcutHotkeyMeta | undefined+ if (!meta?.id || !meta.name) return null+ return {+ id: meta.id,+ label: meta.name,+ sequence: registration.sequence,+ referenceGroup: meta.referenceGroup,+ }+}++const useActiveShortcuts = (): ActiveShortcutDefinition[] => {+ const { sequences } = useHotkeyRegistrations()++ return useMemo(() => {+ const definitions: ActiveShortcutDefinition[] = []+ const seen = new Set<string>()++ for (const registration of sequences) {+ if (registration.options.enabled === false) continue+ const definition = toActiveDefinition(registration)+ if (!definition) continue+ if (seen.has(definition.id)) continue+ seen.add(definition.id)+ definitions.push(definition)+ }++ return definitions+ }, [sequences])+}++const groupDefinitions = (activeShortcuts: ActiveShortcutDefinition[]): ShortcutGroup[] => {+ const grouped = activeShortcuts.reduce<Record<string, ActiveShortcutDefinition[]>>((acc, definition) => {- const prefix = definition.id.split('.')[0]+ const prefix = definition.referenceGroup ?? definition.id.split('.')[0]acc[prefix] = acc[prefix] ?? []acc[prefix].push(definition)return acc@@ -79,12 +112,21 @@ const groupDefinitions = (): ShortcutGroup[] => {{})+ const hasScopedNavigationGroup = Object.keys(grouped).some(isScopedNavigationGroup)+return Object.entries(grouped)- .map(([group, definitions]) => ({- group,- label: getGroupLabel(group),- definitions,- }))+ .map(([group, definitions]) => {+ const label =+ group === SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL && !hasScopedNavigationGroup+ ? 'Navigation'+ : getGroupLabel(group)++ return {+ group,+ label,+ definitions,+ }+ }).sort((a, b) => getGroupOrder(a.group) - getGroupOrder(b.group))}@@ -111,7 +153,7 @@ const filterGroups = (groups: ShortcutGroup[], search: string) => {}, [])}-const ShortcutSequence = ({ sequence }: Pick<ShortcutDefinition, 'sequence'>) => (+const ShortcutSequence = ({ sequence }: Pick<ActiveShortcutDefinition, 'sequence'>) => (<div className="flex items-center gap-1">{sequence.map((step, index) => (<Fragment key={`${step}-${index}`}>@@ -122,69 +164,72 @@ const ShortcutSequence = ({ sequence }: Pick<ShortcutDefinition, 'sequence'>) =></div>)-export function ShortcutsReferenceSheet({ open, onOpenChange }: ShortcutsReferenceSheetProps) {+function ShortcutsReferenceSheetContent() {const [search, setSearch] = useState('')- const groups = filterGroups(groupDefinitions(), search)+ const activeShortcuts = useActiveShortcuts()+ const groups = filterGroups(groupDefinitions(activeShortcuts), search)- useEffect(() => {- if (!open) setSearch('')- }, [open])+ return (+ <>+ <SheetHeader className="shrink-0 py-3">+ <SheetTitle>Keyboard shortcuts</SheetTitle>+ <SheetDescription className="sr-only">+ Browse and search available keyboard shortcuts.+ </SheetDescription>+ </SheetHeader>+ <div className="shrink-0 bg-studio px-5 pt-4 pb-4">+ <Input+ aria-label="Search shortcuts"+ autoFocus+ className="w-full"+ onChange={(event) => setSearch(event.target.value)}+ placeholder="Search shortcuts..."+ value={search}+ actions={+ search ? (+ <Button+ aria-label="Clear search"+ size="tiny"+ type="text"+ icon={<CircleX size={14} />}+ onClick={() => setSearch('')}+ className="h-5 w-5 p-0"+ />+ ) : null+ }+ />+ </div>+ <SheetSection className="flex flex-1 flex-col gap-6 overflow-y-auto px-5 py-4">+ {groups.length === 0 ? (+ <p className="text-sm text-foreground-muted">No matching shortcuts found</p>+ ) : (+ groups.map(({ group, label, definitions }) => (+ <section key={group} className="flex flex-col gap-2">+ <h3 className="text-xs text-foreground-lighter uppercase tracking-wider">{label}</h3>+ <ul className="flex flex-col">+ {definitions.map((definition) => (+ <li+ key={definition.id}+ className="flex min-h-10 items-center justify-between gap-4 border-b border-muted py-2 last:border-b-0"+ >+ <span className="text-sm text-foreground">{definition.label}</span>+ <ShortcutSequence sequence={definition.sequence} />+ </li>+ ))}+ </ul>+ </section>+ ))+ )}+ </SheetSection>+ </>+ )+}+export function ShortcutsReferenceSheet({ open, onOpenChange }: ShortcutsReferenceSheetProps) {return (<Sheet open={open} onOpenChange={onOpenChange}><SheetContent className="flex w-full flex-col gap-0 p-0 sm:max-w-[520px]">- <SheetHeader className="shrink-0 py-3">- <SheetTitle>Keyboard shortcuts</SheetTitle>- <SheetDescription className="sr-only">- Browse and search available keyboard shortcuts.- </SheetDescription>- </SheetHeader>- <div className="shrink-0 bg-studio px-5 pt-4 pb-4">- <Input- aria-label="Search shortcuts"- autoFocus={open}- className="w-full"- onChange={(event) => setSearch(event.target.value)}- placeholder="Search shortcuts..."- value={search}- actions={- search ? (- <Button- aria-label="Clear search"- size="tiny"- type="text"- icon={<CircleX size={14} />}- onClick={() => setSearch('')}- className="h-5 w-5 p-0"- />- ) : null- }- />- </div>- <SheetSection className="flex flex-1 flex-col gap-6 overflow-y-auto px-5 py-4">- {groups.length === 0 ? (- <p className="text-sm text-foreground-muted">No matching shortcuts found</p>- ) : (- groups.map(({ group, label, definitions }) => (- <section key={group} className="flex flex-col gap-2">- <h3 className="text-xs text-foreground-lighter uppercase tracking-wider">- {label}- </h3>- <ul className="flex flex-col">- {definitions.map((definition) => (- <li- key={definition.id}- className="flex min-h-10 items-center justify-between gap-4 border-b border-muted py-2 last:border-b-0"- >- <span className="text-sm text-foreground">{definition.label}</span>- <ShortcutSequence sequence={definition.sequence} />- </li>- ))}- </ul>- </section>- ))- )}- </SheetSection>+ {open && <ShortcutsReferenceSheetContent />}</SheetContent></Sheet>)diff --git a/apps/studio/components/ui/ProductMenu/ProductMenuShortcuts.test.tsx b/apps/studio/components/ui/ProductMenu/ProductMenuShortcuts.test.tsxnew file mode 100644index 00000000000..b142c33e185--- /dev/null+++ b/apps/studio/components/ui/ProductMenu/ProductMenuShortcuts.test.tsx@@ -0,0 +1,111 @@+import { render } from '@testing-library/react'+import { beforeEach, describe, expect, it, vi } from 'vitest'++import type { ProductMenuGroup } from './ProductMenu.types'+import { ProductMenuShortcuts } from './ProductMenuShortcuts'+import { SHORTCUT_IDS } from '@/state/shortcuts/registry'++const { mockPush, mockUseShortcut } = vi.hoisted(() => ({+ mockPush: vi.fn(),+ mockUseShortcut: vi.fn(),+}))++vi.mock('next/router', () => ({+ useRouter: () => ({+ push: mockPush,+ }),+}))++vi.mock('@/state/shortcuts/useShortcut', () => ({+ useShortcut: mockUseShortcut,+}))++const menu: ProductMenuGroup[] = [+ {+ title: 'Visible',+ items: [+ {+ name: 'Tables',+ key: 'tables',+ url: '/project/ref/database/tables',+ shortcutId: SHORTCUT_IDS.NAV_DATABASE_TABLES,+ },+ {+ name: 'Functions',+ key: 'functions',+ url: '/project/ref/database/functions',+ shortcutId: SHORTCUT_IDS.NAV_DATABASE_FUNCTIONS,+ disabled: true,+ },+ {+ name: 'External',+ key: 'external',+ url: 'https://example.com',+ shortcutId: SHORTCUT_IDS.NAV_DATABASE_EXTENSIONS,+ isExternal: true,+ },+ {+ name: 'No shortcut',+ key: 'no-shortcut',+ url: '/project/ref/database/triggers',+ },+ ],+ },+]++describe('ProductMenuShortcuts', () => {+ beforeEach(() => {+ vi.clearAllMocks()+ })++ it('registers visible enabled internal shortcut items', () => {+ render(<ProductMenuShortcuts menu={menu} />)++ expect(mockUseShortcut).toHaveBeenCalledTimes(1)+ expect(mockUseShortcut).toHaveBeenCalledWith(+ SHORTCUT_IDS.NAV_DATABASE_TABLES,+ expect.any(Function)+ )+ })++ it('navigates to the item url when the shortcut fires', () => {+ render(<ProductMenuShortcuts menu={menu} />)++ const callback = mockUseShortcut.mock.calls[0][1]+ callback()++ expect(mockPush).toHaveBeenCalledWith('/project/ref/database/tables')+ })++ it('registers shortcut items nested under childItems', () => {+ render(+ <ProductMenuShortcuts+ menu={[+ {+ title: 'Nested',+ items: [+ {+ name: 'Parent',+ key: 'parent',+ url: '/project/ref/database',+ childItems: [+ {+ name: 'Indexes',+ key: 'indexes',+ url: '/project/ref/database/indexes',+ shortcutId: SHORTCUT_IDS.NAV_DATABASE_INDEXES,+ },+ ],+ },+ ],+ },+ ]}+ />+ )++ expect(mockUseShortcut).toHaveBeenCalledWith(+ SHORTCUT_IDS.NAV_DATABASE_INDEXES,+ expect.any(Function)+ )+ })+})diff --git a/apps/studio/components/ui/ProductMenu/ProductMenuShortcuts.tsx b/apps/studio/components/ui/ProductMenu/ProductMenuShortcuts.tsxnew file mode 100644index 00000000000..582805ae32c--- /dev/null+++ b/apps/studio/components/ui/ProductMenu/ProductMenuShortcuts.tsx@@ -0,0 +1,50 @@+import { useRouter } from 'next/router'+import { useCallback } from 'react'++import type { ProductMenuGroup, ProductMenuGroupItem } from './ProductMenu.types'+import { useShortcut } from '@/state/shortcuts/useShortcut'++interface ProductMenuShortcutsProps {+ menu: ProductMenuGroup[]+}++type ProductMenuShortcutItem = ProductMenuGroupItem & {+ shortcutId: NonNullable<ProductMenuGroupItem['shortcutId']>+}++const getShortcutItems = (items: ProductMenuGroupItem[]): ProductMenuShortcutItem[] => {+ return items.flatMap((item) => {+ const childItems = item.childItems ? getShortcutItems(item.childItems) : []++ if (!item.shortcutId || !item.url || item.disabled || item.isExternal) {+ return childItems+ }++ return [item as ProductMenuShortcutItem, ...childItems]+ })+}++const ProductMenuShortcut = ({ item }: { item: ProductMenuShortcutItem }) => {+ const router = useRouter()+ const { shortcutId, url } = item++ const navigate = useCallback(() => {+ router.push(url)+ }, [router, url])++ useShortcut(shortcutId, navigate)++ return null+}++export const ProductMenuShortcuts = ({ menu }: ProductMenuShortcutsProps) => {+ const shortcutItems = menu.flatMap((group) => getShortcutItems(group.items))++ return (+ <>+ {shortcutItems.map((item) => (+ <ProductMenuShortcut key={`${item.shortcutId}-${item.url}`} item={item} />+ ))}+ </>+ )+}diff --git a/apps/studio/state/shortcuts/referenceGroups.ts b/apps/studio/state/shortcuts/referenceGroups.tsnew file mode 100644index 00000000000..224fe209e15--- /dev/null+++ b/apps/studio/state/shortcuts/referenceGroups.ts@@ -0,0 +1,27 @@+export const SHORTCUT_REFERENCE_GROUPS = {+ NAVIGATION_GLOBAL: 'navigation.global',+ NAVIGATION_DATABASE: 'navigation.database',+} as const++export const SHORTCUT_REFERENCE_GROUP_LABELS: Record<string, string> = {+ [SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL]: 'Global Navigation',+ [SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE]: 'Database Navigation',+}++export const SHORTCUT_REFERENCE_GROUP_ORDER = [+ 'command-menu',+ 'shortcuts',+ SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,+ SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,+ 'nav',+ 'ai-assistant',+ 'inline-editor',+ 'results',+ 'data-table',+ 'table-editor',+ 'schema-visualizer',+ 'list-page',+ 'action-bar',+ 'operation-queue',+ 'unified-logs',+]diff --git a/apps/studio/state/shortcuts/registry.ts b/apps/studio/state/shortcuts/registry.tsindex 425bb75bd62..120eaf267c5 100644--- a/apps/studio/state/shortcuts/registry.ts+++ b/apps/studio/state/shortcuts/registry.ts@@ -1,3 +1,4 @@+import { SHORTCUT_REFERENCE_GROUPS } from './referenceGroups'import { DATABASE_NAV_SHORTCUT_IDS, databaseNavRegistry } from './registry/database-nav'import { LIST_PAGE_SHORTCUT_IDS, listPageRegistry } from './registry/list-page'import {@@ -197,114 +198,133 @@ export const SHORTCUT_DEFINITIONS: Record<ShortcutId, ShortcutDefinition> = {label: 'Go to Project Overview',sequence: ['G', 'H'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_TABLE_EDITOR]: {id: SHORTCUT_IDS.NAV_TABLE_EDITOR,label: 'Go to Table Editor',sequence: ['G', 'T'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_SQL_EDITOR]: {id: SHORTCUT_IDS.NAV_SQL_EDITOR,label: 'Go to SQL Editor',sequence: ['G', 'S'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_DATABASE]: {id: SHORTCUT_IDS.NAV_DATABASE,label: 'Go to Database',sequence: ['G', 'D'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_AUTH]: {id: SHORTCUT_IDS.NAV_AUTH,label: 'Go to Authentication',sequence: ['G', 'A'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_STORAGE]: {id: SHORTCUT_IDS.NAV_STORAGE,label: 'Go to Storage',sequence: ['G', 'B'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_FUNCTIONS]: {id: SHORTCUT_IDS.NAV_FUNCTIONS,label: 'Go to Edge Functions',sequence: ['G', 'F'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_REALTIME]: {id: SHORTCUT_IDS.NAV_REALTIME,label: 'Go to Realtime',sequence: ['G', 'R'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_ADVISORS]: {id: SHORTCUT_IDS.NAV_ADVISORS,label: 'Go to Advisors',sequence: ['G', 'V'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_OBSERVABILITY]: {id: SHORTCUT_IDS.NAV_OBSERVABILITY,label: 'Go to Observability',sequence: ['G', 'U'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_LOGS]: {id: SHORTCUT_IDS.NAV_LOGS,label: 'Go to Logs',sequence: ['G', 'L'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_INTEGRATIONS]: {id: SHORTCUT_IDS.NAV_INTEGRATIONS,label: 'Go to Integrations',sequence: ['G', 'I'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_SETTINGS]: {id: SHORTCUT_IDS.NAV_SETTINGS,label: 'Go to Project Settings',sequence: ['G', ','],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_ORG_PROJECTS]: {id: SHORTCUT_IDS.NAV_ORG_PROJECTS,label: 'Go to Projects',sequence: ['G', 'P'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_ORG_TEAM]: {id: SHORTCUT_IDS.NAV_ORG_TEAM,label: 'Go to Team',sequence: ['G', 'M'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_ORG_INTEGRATIONS]: {id: SHORTCUT_IDS.NAV_ORG_INTEGRATIONS,label: 'Go to Organization Integrations',sequence: ['G', 'I'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_ORG_USAGE]: {id: SHORTCUT_IDS.NAV_ORG_USAGE,label: 'Go to Usage',sequence: ['G', 'U'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_ORG_BILLING]: {id: SHORTCUT_IDS.NAV_ORG_BILLING,label: 'Go to Billing',sequence: ['G', 'B'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.NAV_ORG_SETTINGS]: {id: SHORTCUT_IDS.NAV_ORG_SETTINGS,label: 'Go to Organization Settings',sequence: ['G', 'O'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,},[SHORTCUT_IDS.SHORTCUTS_OPEN_REFERENCE]: {id: SHORTCUT_IDS.SHORTCUTS_OPEN_REFERENCE,diff --git a/apps/studio/state/shortcuts/registry/database-nav.ts b/apps/studio/state/shortcuts/registry/database-nav.tsindex 9a437c3b390..58ce0b116d6 100644--- a/apps/studio/state/shortcuts/registry/database-nav.ts+++ b/apps/studio/state/shortcuts/registry/database-nav.ts@@ -1,3 +1,4 @@+import { SHORTCUT_REFERENCE_GROUPS } from '../referenceGroups'import { RegistryDefinations } from '../types'/**@@ -35,83 +36,97 @@ export const databaseNavRegistry: RegistryDefinations<DatabaseNavShortcutId> = {label: 'Go to Tables',sequence: ['D', 'T'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},[DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_FUNCTIONS]: {id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_FUNCTIONS,label: 'Go to Functions',sequence: ['D', 'F'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},[DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_TRIGGERS]: {id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_TRIGGERS,label: 'Go to Triggers',sequence: ['D', 'R'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},[DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_INDEXES]: {id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_INDEXES,label: 'Go to Indexes',sequence: ['D', 'I'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},[DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_EXTENSIONS]: {id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_EXTENSIONS,label: 'Go to Extensions',sequence: ['D', 'X'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},[DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_SCHEMA_VISUALIZER]: {id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_SCHEMA_VISUALIZER,label: 'Go to Schema Visualizer',sequence: ['D', 'V'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},[DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_ROLES]: {id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_ROLES,label: 'Go to Roles',sequence: ['D', 'O'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},[DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_BACKUPS]: {id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_BACKUPS,label: 'Go to Backups',sequence: ['D', 'B'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},[DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_MIGRATIONS]: {id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_MIGRATIONS,label: 'Go to Migrations',sequence: ['D', 'M'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},[DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_TYPES]: {id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_TYPES,label: 'Go to Enumerated Types',sequence: ['D', 'E'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},[DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_PUBLICATIONS]: {id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_PUBLICATIONS,label: 'Go to Publications',sequence: ['D', 'U'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},[DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_COLUMN_PRIVILEGES]: {id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_COLUMN_PRIVILEGES,label: 'Go to Column Privileges',sequence: ['D', 'C'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},[DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_SETTINGS]: {id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_SETTINGS,label: 'Go to Database Settings',sequence: ['D', ','],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},[DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_REPLICATION]: {id: DATABASE_NAV_SHORTCUT_IDS.NAV_DATABASE_REPLICATION,label: 'Go to Replication',sequence: ['D', 'L'],showInSettings: false,+ referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,},}diff --git a/apps/studio/state/shortcuts/types.ts b/apps/studio/state/shortcuts/types.tsindex ab2b4fcb4b0..1bed754b97f 100644--- a/apps/studio/state/shortcuts/types.ts+++ b/apps/studio/state/shortcuts/types.ts@@ -108,6 +108,12 @@ export interface ShortcutDefinition {* standalone user preference.*/showInSettings?: boolean++ /**+ * Optional grouping override for the Keyboard shortcuts reference sheet.+ * Falls back to the shortcut id prefix when omitted.+ */+ referenceGroup?: string}export type RegistryDefinations<T extends string> = Record<T, ShortcutDefinition>diff --git a/apps/studio/state/shortcuts/useShortcut.test.tsx b/apps/studio/state/shortcuts/useShortcut.test.tsxindex a5484430577..448445b5cb2 100644--- a/apps/studio/state/shortcuts/useShortcut.test.tsx+++ b/apps/studio/state/shortcuts/useShortcut.test.tsx@@ -33,7 +33,12 @@ vi.mock('./useIsShortcutEnabled', () => ({const getLastHotkeyOptions = () => {const call = mockUseHotkeySequence.mock.calls.at(-1)if (!call) throw new Error('useHotkeySequence was not called')- return call[2] as { enabled: boolean; timeout: number | undefined; ignoreInputs?: boolean }+ return call[2] as {+ enabled: boolean+ timeout: number | undefined+ ignoreInputs?: boolean+ meta?: { id?: string; name?: string; referenceGroup?: string }+ }}const getLastRegisterCall = () => {@@ -308,4 +313,33 @@ describe('useShortcut', () => {})})})++ describe('reference-sheet metadata', () => {+ it('forwards id, label, and referenceGroup as registration meta', () => {+ renderHook(() => useShortcut(SHORTCUT_IDS.NAV_HOME, vi.fn()))+ expect(getLastHotkeyOptions().meta).toEqual({+ id: SHORTCUT_IDS.NAV_HOME,+ name: SHORTCUT_DEFINITIONS[SHORTCUT_IDS.NAV_HOME].label,+ referenceGroup: SHORTCUT_DEFINITIONS[SHORTCUT_IDS.NAV_HOME].referenceGroup,+ })+ })++ it('uses the caller label override in meta.name', () => {+ renderHook(() => useShortcut(SHORTCUT_IDS.NAV_HOME, vi.fn(), { label: 'Go home' }))+ expect(getLastHotkeyOptions().meta?.name).toBe('Go home')+ })++ it('keeps a stable meta reference when inputs do not change', () => {+ const { rerender } = renderHook(+ ({ cb }: { cb: () => void }) => useShortcut(SHORTCUT_IDS.NAV_HOME, cb),+ { initialProps: { cb: vi.fn() } }+ )++ const first = getLastHotkeyOptions().meta++ rerender({ cb: vi.fn() })++ expect(getLastHotkeyOptions().meta).toBe(first)+ })+ })})diff --git a/apps/studio/state/shortcuts/useShortcut.tsx b/apps/studio/state/shortcuts/useShortcut.tsxindex fc16bd4c139..698c787425e 100644--- a/apps/studio/state/shortcuts/useShortcut.tsx+++ b/apps/studio/state/shortcuts/useShortcut.tsx@@ -1,5 +1,5 @@-import { useHotkeySequence } from '@tanstack/react-hotkeys'-import { Fragment, useCallback } from 'react'+import { useHotkeySequence, type HotkeyMeta } from '@tanstack/react-hotkeys'+import { Fragment, useCallback, useMemo } from 'react'import { KeyboardShortcut } from 'ui'import { useRegisterCommands, useSetCommandMenuOpen } from 'ui-patterns/CommandMenu'import type { ICommand } from 'ui-patterns/CommandMenu/api/types'@@ -10,6 +10,17 @@ import { useIsShortcutEnabled } from './useIsShortcutEnabled'import { COMMAND_MENU_SECTIONS } from '@/components/interfaces/App/CommandMenu/CommandMenu.utils'import useLatest from '@/hooks/misc/useLatest'+/**+ * Shape we store on each registration's `options.meta` so the Keyboard+ * shortcuts reference sheet can read it back via `useHotkeyRegistrations()`.+ * The library's `HotkeyMeta` is open for declaration merging, but we don't+ * own a direct dep on `@tanstack/hotkeys`, so we keep the extension local.+ */+export interface ShortcutHotkeyMeta extends HotkeyMeta {+ id: ShortcutId+ referenceGroup?: string+}+const hotkeyToKeys = (hotkey: string): string[] =>hotkey.split('+').map((part) => (part === 'Mod' ? 'Meta' : part))@@ -74,6 +85,14 @@ export function useShortcut(id: ShortcutId, callback: () => void, options?: Shoroptions?.registerInCommandMenu ?? def.options?.registerInCommandMenu ?? falseconst label = options?.label ?? def.label+ // Stable identity so we don't churn the registration store on every render.+ // setOptions in @tanstack/hotkeys notifies subscribers each call, which+ // would cascade to every component using useHotkeyRegistrations().+ const meta = useMemo<ShortcutHotkeyMeta>(+ () => ({ id, name: label, referenceGroup: def.referenceGroup }),+ [def.referenceGroup, id, label]+ )+// Only include `ignoreInputs` when set. The library resolves it to a concrete// boolean at register time (false for Meta/Ctrl/Escape, true otherwise), but// its setOptions does an object spread on every re-render — passing@@ -82,6 +101,7 @@ export function useShortcut(id: ShortcutId, callback: () => void, options?: ShoruseHotkeySequence(def.sequence, callback, {enabled,timeout,+ meta,...(ignoreInputs !== undefined && { ignoreInputs }),})