Skip to content

fix(desktop): hotkey migration translates punctuation + runs once - #3368

Closed
Kitenite wants to merge 1 commit into
mainfrom
add-shortcut-migration
Closed

Kitenite wants to merge 1 commit into
mainfrom
add-shortcut-migration

Conversation

@Kitenite

@Kitenite Kitenite commented Apr 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Two bugs in the post-rewrite hotkey migration shipped in #3178:

  • Migration re-ran on every launch. The guard checked for the hotkey-overrides localStorage key, but Zustand's persist middleware doesn't write that key until the store mutates. Users who never customized anything kept hitting the legacy tRPC endpoint forever. Replaced with a dedicated hotkey-overrides-migrated sentinel written in every terminal branch (success, no-op, error).
  • Punctuation overrides silently stopped working. The new registry declares punctuation via code-based names (bracketleft, bracketright, comma, slash, …) because react-hotkeys-hook matches on KeyboardEvent.code. The old store held the literal character ("["). The migration copied overrides verbatim, so any user-customized binding using [ ] , . / \ ; ' - =` was migrated into the new store but never fired. Added a token-level translation table applied before write.

Test plan

  • bun test src/renderer/hotkeys/migrate.test.ts — 6/6 pass, including a multi-call test that asserts the sentinel prevents repeat tRPC queries, and a translation test that asserts meta+[ → meta+bracketleft.
  • bun run typecheck clean in apps/desktop.
  • Manual: seed ~/.superset/app-state.json with hotkeysState.byPlatform.darwin overrides that include punctuation, clear localStorage["hotkey-overrides"] and localStorage["hotkey-overrides-migrated"], reload, confirm bindings fire.

Summary by cubic

Fixes the desktop hotkey migration so it runs once and preserves punctuation-based shortcuts by translating them to the new code-based names. Prevents repeated legacy tRPC calls and ensures custom bindings like meta+[ still work.

  • Bug Fixes
    • Add hotkey-overrides-migrated sentinel to stop re-running the migration on every launch.
    • Translate punctuation tokens from old character strings to code-based names before saving (e.g., [ → bracketleft).

Written for commit 4f74b03. Summary will update on new commits.

Two bugs in the post-rewrite hotkey migration (#3178):

1. The "already migrated" guard checked for the `hotkey-overrides`
   localStorage key, but Zustand's persist middleware doesn't write it
   until the store mutates. Users who never customized anything re-ran
   the migration (and re-hit the legacy tRPC endpoint) every launch.
   Replaced with a dedicated `hotkey-overrides-migrated` sentinel set
   in every terminal branch.

2. The new registry declares punctuation via code-based names
   (`bracketleft`, `comma`, `slash`, …) because react-hotkeys-hook
   matches on `KeyboardEvent.code`. The old store held the literal
   character ("["). The migration copied overrides verbatim, so
   anything bound to `[ ] , . / \ ; ' backtick - =` silently stopped
   working after upgrade. Added a token-level translation table.

Adds migrate.test.ts covering both fixes plus the existing branches.
@coderabbitai

coderabbitai Bot commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7c4aa622-e64b-448c-8141-5510c85662a1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-shortcut-migration

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.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) ✅ View Branch
Fly.io Electric (Fly.io) ✅ View App
Vercel API (Vercel) ✅ Open Preview
Vercel Web (Vercel) ✅ Open Preview
Vercel Marketing (Vercel) ✅ Open Preview
Vercel Admin (Vercel) ✅ Open Preview
Vercel Docs (Vercel) ✅ Open Preview

Preview updates automatically with new commits

@Kitenite Kitenite closed this Jul 11, 2026

This branch was previously deployed

1 inactive deployment
preview — 4f74b031 Deployed Apr 12, 2026 by Kitenite via Deploy Marketing #3890
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