From f90f3b4d14a2d588d34851d8cf8f7bc40523f0b5 Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Fri, 30 Jan 2026 10:44:42 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"Revert=20"Fix=20queue=20operations=20?= =?UTF-8?q?stale=20state=20+=20refactor=20to=20reuse=20existing=E2=80=A6"?= =?UTF-8?q?=20(#42291)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TBD ## 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) ✏️ Tip: You can customize this high-level summary in your review settings. --- .../footer/operations/SaveQueueActionBar.tsx | 31 +++----- .../header/sort/SortPopoverPrimitive.tsx | 14 ++-- .../grid/hooks/useOperationQueueActions.ts | 14 ++-- .../grid/hooks/useOperationQueueShortcuts.ts | 78 +++++++------------ .../interfaces/App/RouteValidationWrapper.tsx | 11 ++- .../OperationQueueSidePanel/OperationItem.tsx | 15 ++-- .../OperationQueueSidePanel.tsx | 13 +--- apps/studio/hooks/ui/useHotKey.ts | 44 ++++++++--- apps/studio/lib/helpers.ts | 5 ++ apps/studio/state/table-editor.tsx | 22 +++--- 10 files changed, 120 insertions(+), 127 deletions(-) diff --git a/apps/studio/components/grid/components/footer/operations/SaveQueueActionBar.tsx b/apps/studio/components/grid/components/footer/operations/SaveQueueActionBar.tsx index 65be243d127..c554f2065dc 100644 --- a/apps/studio/components/grid/components/footer/operations/SaveQueueActionBar.tsx +++ b/apps/studio/components/grid/components/footer/operations/SaveQueueActionBar.tsx @@ -1,21 +1,22 @@ -import { Eye } from 'lucide-react' +import { useOperationQueueActions } from 'components/grid/hooks/useOperationQueueActions' +import { useOperationQueueShortcuts } from 'components/grid/hooks/useOperationQueueShortcuts' +import { useIsQueueOperationsEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' import { AnimatePresence, motion } from 'framer-motion' +import { Eye } from 'lucide-react' import { createPortal } from 'react-dom' +import { useTableEditorStateSnapshot } from 'state/table-editor' import { Button } from 'ui' -import { - useOperationQueueShortcuts, - getModKey, -} from 'components/grid/hooks/useOperationQueueShortcuts' -import { useIsQueueOperationsEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' -import { useTableEditorStateSnapshot } from 'state/table-editor' -import { useOperationQueueActions } from 'components/grid/hooks/useOperationQueueActions' +import { getModKeyLabel } from '@/lib/helpers' export const SaveQueueActionBar = () => { + const modKey = getModKeyLabel() const snap = useTableEditorStateSnapshot() const isQueueOperationsEnabled = useIsQueueOperationsEnabled() const { handleSave } = useOperationQueueActions() + useOperationQueueShortcuts() + const operationCount = snap.operationQueue.operations.length const isSaving = snap.operationQueue.status === 'saving' const isOperationQueuePanelOpen = snap.sidePanel?.type === 'operation-queue' @@ -23,16 +24,6 @@ export const SaveQueueActionBar = () => { const isVisible = isQueueOperationsEnabled && snap.hasPendingOperations && !isOperationQueuePanelOpen - useOperationQueueShortcuts({ - enabled: isQueueOperationsEnabled && snap.hasPendingOperations, - onSave: handleSave, - onTogglePanel: () => snap.onViewOperationQueue(), - isSaving, - hasOperations: operationCount > 0, - }) - - const modKey = getModKey() - const content = ( {isVisible && ( @@ -49,7 +40,7 @@ export const SaveQueueActionBar = () => {
-