-
Notifications
You must be signed in to change notification settings - Fork 5.7k
fix(web): allow changing keybindings in settings #11621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -751,6 +751,17 @@ function KeybindingTableRow({ | |||||
| onRemove: (row: KeybindingRow) => void; | ||||||
| }) { | ||||||
| const [draft, setDraft] = useReducer(keybindingRowDraftReducer, row, createKeybindingRowDraft); | ||||||
| // Reset draft when the persisted row changes (e.g. after a successful save | ||||||
| // pushes new config via the subscription stream). Without this the stale | ||||||
| // draft keeps showing the pre-save values and the row appears stuck. | ||||||
| useEffect(() => { | ||||||
| setDraft({ | ||||||
| keyDraft: row.key, | ||||||
| whenDraft: row.binding.whenAst, | ||||||
| isRecording: false, | ||||||
| isWhenDraftValid: true, | ||||||
| }); | ||||||
| }, [row.key, row.binding.whenAst]); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When another keybinding is edited through AGENTS.md reference: AGENTS.md:L74-L74 Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Use stable persisted values for the row reset effect. When the server recompiles all bindings after a save, an unchanged row receives a new - }, [row.key, row.binding.whenAst]);
+ }, [row.command, row.key, row.when]);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| const { keyDraft, whenDraft, isRecording, isWhenDraftValid } = draft; | ||||||
| const whenDraftExpression = whenAstToExpression(whenDraft); | ||||||
| const isDirty = keyDraft !== row.key || whenDraftExpression !== row.when; | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium
settings/KeybindingsSettings.tsx:764Saving a different keybinding resets this row's in-progress
whenedit, becauserow.binding.whenAstgets a fresh object whenever the custom config is recompiled even when this row's persisted value is unchanged. Depend on the persistedrow.whenexpression instead, so the draft resets only when this row actually changes.🤖 Copy this AI Prompt to have your agent fix this: