feat: callback version of conflictBehavior#54
Open
skyboyer wants to merge 3 commits intoTanStack:mainfrom
Open
feat: callback version of conflictBehavior#54skyboyer wants to merge 3 commits intoTanStack:mainfrom
skyboyer wants to merge 3 commits intoTanStack:mainfrom
Conversation
skyboyer
commented
Mar 7, 2026
| <div class={styles().optionRow}> | ||
| <span class={styles().optionLabel}>conflictBehavior</span> | ||
| <span class={styles().optionValue}>{conflictBehavior()}</span> | ||
| <span class={styles().optionValue}>{serializeConflictBehavior(conflictBehavior())}</span> |
Author
There was a problem hiding this comment.
conflictBehavior() cannot be directly rendered in JSX any more. I considered String(conflictBehavior()) but it just dumps callback version as plain JS code which does not look good 😅
skyboyer
commented
Mar 7, 2026
| } | ||
|
|
||
| if (typeof conflictBehavior === 'function') { | ||
| conflictBehavior(keyDisplay, () => unregister(conflictingId)) |
Author
There was a problem hiding this comment.
I don't think it makes sense to expose conflictingId and unregister separately in this case with a callback
| 'Mod+S', | ||
| expect.any(Function), | ||
| ) | ||
| handleConflictCallback.mock.calls[0]?.[1]() |
Author
There was a problem hiding this comment.
mimics custom async logic inside the callback, e.g. call unregisterConflicting after displaying a popup and user clicked "Confirm"
@tanstack/hotkeys
@tanstack/hotkeys-devtools
@tanstack/preact-hotkeys
@tanstack/preact-hotkeys-devtools
@tanstack/react-hotkeys
@tanstack/react-hotkeys-devtools
@tanstack/solid-hotkeys
@tanstack/solid-hotkeys-devtools
commit: |
skyboyer
commented
Mar 8, 2026
| - `'warn'` - Log a warning to the console but allow both registrations (default) | ||
| - `'error'` - Throw an error and prevent the new registration | ||
| - `'replace'` - Unregister the existing registration and register the new one | ||
| - `'allow'` - Allow multiple registrations without warning |
Author
There was a problem hiding this comment.
I added a new entry here but autofix removed it.
- custom callback - You can log the issue with configuration or unregister conflicting registration conditionally e.g. with showing confirmation popup
How could I keep it?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Changes
As discussed in #47 we may want to do unregister conflicting hot key conditionally(e.g. after showing the confirmation popup) instead of doing it always. Or we may want to log conflict to a remote endpoint, not just show error locally.

Here is how it will be reflected in DevTools:
✅ Checklist
pnpm run test:pr.🚀 Release Impact