Skip to content

fix(desktop): Cmd+O firing open-in twice on v1 workspace route#3511

Merged
Kitenite merged 1 commit into
mainfrom
broken-traveler
Apr 16, 2026
Merged

fix(desktop): Cmd+O firing open-in twice on v1 workspace route#3511
Kitenite merged 1 commit into
mainfrom
broken-traveler

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Apr 16, 2026

Summary

  • OPEN_IN_APP was registered in two places on the v1 workspace route — OpenInMenuButton and the page component — each with its own electronTrpc.external.openInApp.useMutation() instance. react-hotkeys-hook fires every registered listener, so Cmd+O triggered two mutations while clicking the button triggered one, causing the external app to be opened twice (and racing projects.getDefaultApp invalidation).
  • Remove the page-level useHotkey("OPEN_IN_APP", handleOpenInApp) in workspace/$workspaceId/page.tsx so the shortcut is handled only by OpenInMenuButton, matching the click path exactly.
  • resolvedDefaultApp / handleOpenInApp stay in the page because WorkspaceLayout still uses them (defaultExternalApp, onOpenInApp) for EmptyTabView etc.

Test plan

  • On a v1 workspace route, press Cmd+O — the configured external app opens exactly once.
  • Click the Open In button — the configured external app still opens exactly once.
  • Open the dropdown and choose a different app — it opens once and becomes the new default.
  • EmptyTabView's "Open in app" link still works (uses onOpenInApp from the page).
  • v2 workspace route: Cmd+O and the V2 Open In button continue to behave the same (untouched).

Summary by cubic

Fixes Cmd+O on the v1 workspace route opening the external app twice by removing the duplicate OPEN_IN_APP hotkey listener so the shortcut uses the same handler as the Open In button.

  • Bug Fixes
    • Removed useHotkey("OPEN_IN_APP", handleOpenInApp) from workspace/$workspaceId/page.tsx; OpenInMenuButton now exclusively handles the shortcut.
    • Left resolvedDefaultApp/onOpenInApp on the page for WorkspaceLayout/EmptyTabView; v2 workspace route unchanged.

Written for commit 753fdf2. Summary will update on new commits.

Summary by CodeRabbit

  • Refactor
    • Removed hotkey trigger for opening items in app; the feature continues to work through alternative methods.

OPEN_IN_APP was registered both in OpenInMenuButton and in the v1
workspace page, so pressing Cmd+O ran two separate openInApp mutations
(one per component's own useMutation instance) while clicking the
button only ran one. Remove the page-level registration so the shortcut
goes through the same handler as the click.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b5c43cbb-f711-4c0b-a6c4-3b48aac1f8d0

📥 Commits

Reviewing files that changed from the base of the PR and between b0599bb and 753fdf2.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/workspace/$workspaceId/page.tsx
💤 Files with no reviewable changes (1)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/workspace/$workspaceId/page.tsx

📝 Walkthrough

Walkthrough

The hotkey registration for OPEN_IN_APP was removed from the WorkspacePage() component. The handleOpenInApp callback remains functional and is still passed to WorkspaceLayout via the onOpenInApp prop, maintaining the open-in-app feature without the global hotkey trigger at the route level.

Changes

Cohort / File(s) Summary
Hotkey Registration Removal
apps/desktop/src/renderer/routes/_authenticated/_dashboard/workspace/$workspaceId/page.tsx
Removed useHotkey("OPEN_IN_APP", ...) registration while preserving the callback functionality through layout props.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 One hotkey removed, so clean and bright,
The callback still works, everything's right,
Through layout props the magic flows,
Simpler code as the refactor goes! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main fix: removing duplicate hotkey registration that caused Cmd+O to fire open-in twice.
Description check ✅ Passed The description is comprehensive and well-structured, covering the bug explanation, solution, testing plan, and noting preserved functionality for WorkspaceLayout.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch broken-traveler

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.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 16, 2026

Greptile Summary

This PR fixes a double-invocation bug on the v1 workspace route where pressing Cmd+O (the OPEN_IN_APP hotkey) caused the external app to open twice. The root cause was that useHotkey("OPEN_IN_APP", handleOpenInApp) was registered in both the page component (workspace/$workspaceId/page.tsx) and inside OpenInMenuButtonreact-hotkeys-hook fires every registered listener for a given key, so the keyboard shortcut triggered two separate electronTrpc.external.openInApp.useMutation calls while a button click only triggered one.

The fix removes the redundant page-level hotkey registration while keeping resolvedDefaultApp and handleOpenInApp in the page (correctly, as they are still passed as props to WorkspaceLayout for EmptyTabView and similar consumers). The v2 workspace route is unaffected.

Key changes:

  • Removed useHotkey("OPEN_IN_APP", handleOpenInApp) from workspace/$workspaceId/page.tsx
  • handleOpenInApp, resolvedDefaultApp, and mutateOpenInApp are retained — passed to WorkspaceLayout via onOpenInApp and defaultExternalApp props
  • The shortcut is now handled exclusively by OpenInMenuButton, matching the click path exactly

Confidence Score: 5/5

Safe to merge — single-line removal of a duplicate hotkey registration with no functional regressions

The change is a minimal, targeted removal of one useHotkey call that was proven to cause a double-fire. The retained code is still needed for WorkspaceLayout props. The v2 route is untouched. No logic is rewritten; no new code is introduced. Risk of regression is essentially zero.

No files require special attention

Important Files Changed

Filename Overview
apps/desktop/src/renderer/routes/_authenticated/_dashboard/workspace/$workspaceId/page.tsx Removed duplicate useHotkey("OPEN_IN_APP", handleOpenInApp) registration; handleOpenInApp / resolvedDefaultApp correctly retained for WorkspaceLayout props — fix is minimal and targeted

Sequence Diagram

sequenceDiagram
    participant User
    participant ReactHotkeys as react-hotkeys-hook
    participant OpenInMenuButton
    participant PageComponent as workspace/page.tsx (removed)
    participant Mutation as electronTrpc.external.openInApp

    Note over ReactHotkeys,PageComponent: BEFORE fix — Cmd+O fires both registered handlers

    User->>ReactHotkeys: Press Cmd+O
    ReactHotkeys->>OpenInMenuButton: handleOpenInEditor()
    OpenInMenuButton->>Mutation: mutate({ path, app, projectId })
    Mutation-->>OpenInMenuButton: success → invalidate getDefaultApp
    ReactHotkeys->>PageComponent: handleOpenInApp() [DUPLICATE]
    PageComponent->>Mutation: mutate({ path, app, projectId }) [RACE]
    Mutation-->>PageComponent: success → invalidate getDefaultApp

    Note over ReactHotkeys,PageComponent: AFTER fix — Cmd+O fires only OpenInMenuButton handler

    User->>ReactHotkeys: Press Cmd+O
    ReactHotkeys->>OpenInMenuButton: handleOpenInEditor()
    OpenInMenuButton->>Mutation: mutate({ path, app, projectId })
    Mutation-->>OpenInMenuButton: success → invalidate getDefaultApp
Loading

Reviews (1): Last reviewed commit: "fix(desktop): Cmd+O firing open-in twice..." | Re-trigger Greptile

@Kitenite Kitenite merged commit 07c1ee0 into main Apr 16, 2026
7 checks passed
@Kitenite Kitenite deleted the broken-traveler branch April 16, 2026 22:45
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

MocA-Love pushed a commit to MocA-Love/superset that referenced this pull request Apr 17, 2026
…set-sh#3511)

OPEN_IN_APP was registered both in OpenInMenuButton and in the v1
workspace page, so pressing Cmd+O ran two separate openInApp mutations
(one per component's own useMutation instance) while clicking the
button only ran one. Remove the page-level registration so the shortcut
goes through the same handler as the click.
MocA-Love added a commit to MocA-Love/superset that referenced this pull request Apr 17, 2026
FORK NOTE: upstream superset-sh#3511 removed the page-level OPEN_IN_APP hotkey on the
v1 workspace route to avoid firing Cmd+O twice with OpenInMenuButton. The
fork renders no TopBar in tearoff windows (layout.tsx gates it on
!isTearoff), so removing the page-level registration killed Cmd+O inside
tearoff windows entirely. Guard the registration with isTearoffWindow()
so the main window still gets the upstream double-fire fix while tearoff
windows retain the shortcut.
MocA-Love added a commit to MocA-Love/superset that referenced this pull request Apr 17, 2026
MocA-Love added a commit to MocA-Love/superset that referenced this pull request Apr 17, 2026
Upstream commits processed (cherry-picked, then adapted where needed):

- 07c1ee0 fix(desktop): Cmd+O firing open-in twice on v1 workspace route (superset-sh#3511)
  → PR #302 (with fork tearoff-window adaptation for Cmd+O)
- 4a1f41a chore(deps): upgrade tanstack/db + electric, drop durable-streams patch (superset-sh#3509)
  → PR #303 (fork keeps fstream patch)
- a3df489 feat(desktop): v2 PR checkout via widened checkout procedure (superset-sh#3525)
  → PR #304 (clean)
- c504a50 feat(desktop): v2 file editor — foundation, views, and stability pass (superset-sh#3526)
  → PR #310 (foundation: 58 files path-checkout)
  → PR #311 (adaptation: 20 files manual port with SpreadsheetViewer/memo/fork-hotkeys preserved)
- 78b7dc8 feat(desktop): promote "Create Section Below" to top-level on workspace menu (superset-sh#3537)
  → PR #308

Record merge so upstream/main..main shows 0 behind.
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.

1 participant