Skip to content

fix(desktop): respect preset execution mode when using hotkeys#999

Merged
Kitenite merged 2 commits into
superset-sh:mainfrom
chasemcdo:chase-mcdougall/preset-shortcut-bug
Jan 28, 2026
Merged

fix(desktop): respect preset execution mode when using hotkeys#999
Kitenite merged 2 commits into
superset-sh:mainfrom
chasemcdo:chase-mcdougall/preset-shortcut-bug

Conversation

@chasemcdo
Copy link
Copy Markdown
Contributor

@chasemcdo chasemcdo commented Jan 27, 2026

Summary

  • Preset hotkeys (Ctrl+1-9) now correctly execute commands in parallel when the preset's executionMode is set to "parallel", matching the behavior of the dropdown menu
  • Extracted shared openPreset function into useTabsWithPresets hook to consolidate preset-opening logic

Problem

The hotkey handler always called addTab which creates a single pane and joins commands with && (sequential execution), ignoring the preset's executionMode setting. The dropdown menu correctly handled this by checking the execution mode and calling addTabWithMultiplePanes for parallel presets.

Test plan

  • Create a preset with multiple commands and executionMode: "parallel"
  • Open via dropdown menu: commands execute in parallel (separate panes)
  • Open via hotkey (Ctrl+1): commands also execute in parallel (separate panes)
  • Verify sequential presets still work correctly via both paths

Summary by CodeRabbit

  • Improvements

    • Streamlined workspace preset operations with a unified preset-opening mechanism that consolidates multiple manual steps and conditional logic into a single, consistent action across all workspace components.
  • Refactor

    • Simplified preset-handling code by eliminating redundant operations and reorganizing how workspace presets are created, opened, and managed throughout the application for improved consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

Preset hotkeys (Ctrl+1-9) now correctly execute commands in parallel
when the preset's executionMode is set to "parallel", matching the
behavior of the dropdown menu.
Consolidate preset-opening logic (execution mode handling, tab creation,
renaming) into a shared openPreset function to reduce duplication between
hotkey handler and dropdown menu.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

The PR introduces an openPreset method to the useTabsWithPresets hook that consolidates preset tab creation logic. This method replaces scattered manual tab construction and renaming operations previously distributed across WorkspacePage and GroupStrip components, handling both single and multi-pane preset modes.

Changes

Cohort / File(s) Summary
Hook implementation
apps/desktop/src/renderer/stores/tabs/useTabsWithPresets.ts
Added openPreset(workspaceId, preset) method that handles single vs. multi-pane tab creation based on preset execution mode, performs optional tab renaming, and returns the created tab ID. Imports TerminalPreset type and memoizes the new method with internal store dependencies.
Component consumers
apps/desktop/src/renderer/routes/_authenticated/_dashboard/workspace/$workspaceId/page.tsx, apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/GroupStrip/GroupStrip.tsx
Updated to consume the new openPreset API instead of inline preset handling. Removed local tab construction logic, renaming state, and addTabWithMultiplePanes branching; replaced with single openPreset() calls. Simplified handleSelectPreset signature in GroupStrip.

Sequence Diagram

sequenceDiagram
    actor User
    participant WorkspacePage/GroupStrip as Component:<br/>WorkspacePage/<br/>GroupStrip
    participant openPreset as openPreset Method
    participant storeActions as Store Actions:<br/>storeAddTab/<br/>storeAddTabWithMultiplePanes
    participant renameTab as renameTab

    User->>WorkspacePage/GroupStrip: Select preset
    WorkspacePage/GroupStrip->>openPreset: openPreset(workspaceId, preset)
    alt preset.executionMode === "parallel"<br/>AND commands.length > 1
        openPreset->>storeActions: storeAddTabWithMultiplePanes(...)
    else Single pane mode
        openPreset->>storeActions: storeAddTab(...)
    end
    storeActions-->>openPreset: tabId
    alt preset.name provided
        openPreset->>renameTab: renameTab(tabId, preset.name)
        renameTab-->>openPreset: ✓
    end
    openPreset-->>WorkspacePage/GroupStrip: { tabId }
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested reviewers

  • saddlepaddle

Poem

🐰 Presets now flow through a single door,
No scattered logic to balance anymore!
openPreset handles the dance—
Single pane or parallel's chance,
Tab creation streamlined to the core. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(desktop): respect preset execution mode when using hotkeys' accurately describes the main change: fixing hotkey behavior to respect preset execution modes.
Description check ✅ Passed The pull request description comprehensively addresses the PR objectives, including the problem statement, solution approach, and detailed test plan with verification steps.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chasemcdo
Copy link
Copy Markdown
Contributor Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love a good refactor!

@Kitenite Kitenite merged commit 99c04b5 into superset-sh:main Jan 28, 2026
5 checks passed
MocA-Love added a commit to MocA-Love/superset that referenced this pull request Apr 15, 2026
- native addon: drop the VDBG macro, #include <stdio.h>, and all
  dispatch_block stderr traces so the macOS binary no longer writes to
  stderr on every setWindowBlurRadius call (rv-pr items [2][3][7])
- @superset/macos-window-blur/index.js: remove the success-path
  console.log added while debugging the initial integration
- main/lib/vibrancy/index.ts: delete the vdbg() helper and every
  console.log call site; keep the scheduleNativeBlur retry loop
  otherwise unchanged
- main/windows/main.ts: subscribe to nativeTheme.on("updated") so
  macOS dark/light appearance changes re-run applyVibrancy against
  the latest isDark; the previous implementation pinned the
  BrowserWindow background color to whatever isDark was at the last
  mutation, which left the tint stale on system theme transitions
  when the user picked the "system" theme (rv-pr item [13])
- SpreadsheetViewer / SpreadsheetDiffViewer: replace the remaining
  hardcoded #d0d0d0 / #f5f5f5 / #c0c0c0 / #f0f0f0 / superset-sh#666 / superset-sh#999 /
  #fafafa / #e0e0e0 / #f8f8f8 / superset-sh#888 cells, borders, and text colors
  with var(--border) / var(--muted) / var(--muted-foreground) so the
  spreadsheet grid honours both dark mode and the vibrancy overlay
  (rv-pr item [15] plus the neighbouring SpreadsheetViewer cells
  found while fixing it)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants