Skip to content

fix: guard against undefined commandShortcuts when saving shortcuts#264

Open
arashsheyda wants to merge 1 commit intovitejs:mainfrom
arashsheyda:fix/undefined-commandShortcuts
Open

fix: guard against undefined commandShortcuts when saving shortcuts#264
arashsheyda wants to merge 1 commit intovitejs:mainfrom
arashsheyda:fix/undefined-commandShortcuts

Conversation

@arashsheyda
Copy link
Copy Markdown
Contributor

Description

Saving a keyboard shortcut would throw Cannot set properties of undefined when commandShortcuts was missing from persisted settings (e.g. settings saved before this field existed).

Linked Issues

closes #263

Additional context

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 25, 2026

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@264

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@264

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@264

@vitejs/devtools-rpc

npm i https://pkg.pr.new/@vitejs/devtools-rpc@264

@vitejs/devtools-self-inspect

npm i https://pkg.pr.new/@vitejs/devtools-self-inspect@264

commit: 5784360

@antfu
Copy link
Copy Markdown
Member

antfu commented Mar 25, 2026

But with mergeInitialValue it should have always be initilized - so if there is something wrong on that, it's better for us to fix that instead, otherwise the similar issue could occur again when we add new values in the the settings

@arashsheyda
Copy link
Copy Markdown
Contributor Author

oh I didn't realize. I try to put a fresh reproduction, thanks

@arashsheyda
Copy link
Copy Markdown
Contributor Author

@antfu I coudln't make a reproduction in stackblitz since catalog is not supported I think. but if you delete your node_modules and re-install and then run pnpm play and try to save a shortcut, you should see the error. I wasn't able to fix it otherwise I'm leaving this to you (feel free to close my PR or push to it :ty:)

Screen.Recording.2026-03-25.at.9.10.04.PM.mov

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.

TypeError: Cannot set properties of undefined when saving keyboard shortcuts

2 participants