Skip to content

feat: callback version of conflictBehavior#54

Open
skyboyer wants to merge 1 commit intoTanStack:mainfrom
skyboyer:feat-callback-for-conflictbehavior
Open

feat: callback version of conflictBehavior#54
skyboyer wants to merge 1 commit intoTanStack:mainfrom
skyboyer:feat-callback-for-conflictbehavior

Conversation

@skyboyer
Copy link

@skyboyer skyboyer commented Mar 7, 2026

🎯 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:
2026-03-07 09_24_38

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

<div class={styles().optionRow}>
<span class={styles().optionLabel}>conflictBehavior</span>
<span class={styles().optionValue}>{conflictBehavior()}</span>
<span class={styles().optionValue}>{serializeConflictBehavior(conflictBehavior())}</span>
Copy link
Author

Choose a reason for hiding this comment

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

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 😅

}

if (typeof conflictBehavior === 'function') {
conflictBehavior(keyDisplay, () => unregister(conflictingId))
Copy link
Author

Choose a reason for hiding this comment

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

I don't think it makes sense to expose conflictingId and unregister separately in this callback

'Mod+S',
expect.any(Function),
)
handleConflictCallback.mock.calls[0]?.[1]()
Copy link
Author

Choose a reason for hiding this comment

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

mimics custom async logic inside the callback, e.g. call unregisterConflicting after displaying a popup and user clicked "Confirm"

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