mirror of
https://github.com/supabase/supabase.git
synced 2026-10-07 02:15:05 +03:00
TBD
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* OS-aware modifier-key label shown in UI (⌘ on macOS, Ctrl+ on others)
* Tooltips added to operation queue actions for improved usability
* **Bug Fixes**
* Warns before applying non-primary-key sorts on large tables
* Clarified access error messages for organizations and projects
* **Refactor**
* Redesigned hotkey handling and operation-queue shortcuts
* Operation queue view toggle and save flow refined (panel auto-closes
after save)
<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import { useOperationQueueActions } from './useOperationQueueActions'
|
|
import { useIsQueueOperationsEnabled } from '@/components/interfaces/App/FeaturePreview/FeaturePreviewContext'
|
|
import { useHotKey } from '@/hooks/ui/useHotKey'
|
|
import { useTableEditorStateSnapshot } from '@/state/table-editor'
|
|
|
|
/**
|
|
* Hook that provides keyboard shortcuts for the operation queue.
|
|
*
|
|
* Shortcuts:
|
|
* - Cmd/Ctrl + S: Save all pending changes
|
|
* - Cmd/Ctrl + .: Toggle the operation queue side panel
|
|
*
|
|
* These shortcuts are registered on the capture phase to ensure they fire
|
|
* before the data grid handles the keyboard event.
|
|
*/
|
|
export function useOperationQueueShortcuts() {
|
|
const isQueueOperationsEnabled = useIsQueueOperationsEnabled()
|
|
const snap = useTableEditorStateSnapshot()
|
|
const { handleSave } = useOperationQueueActions()
|
|
|
|
const isSaving = snap.operationQueue.status === 'saving'
|
|
const hasOperations = snap.hasPendingOperations
|
|
const isEnabled = isQueueOperationsEnabled && hasOperations
|
|
|
|
useHotKey(
|
|
(event) => {
|
|
event.preventDefault()
|
|
event.stopPropagation()
|
|
if (!isSaving && hasOperations) {
|
|
handleSave()
|
|
}
|
|
},
|
|
's',
|
|
{ enabled: isEnabled }
|
|
)
|
|
|
|
useHotKey(
|
|
(event) => {
|
|
event.preventDefault()
|
|
event.stopPropagation()
|
|
snap.toggleViewOperationQueue()
|
|
},
|
|
'.',
|
|
{ enabled: isEnabled }
|
|
)
|
|
}
|