Skip to content

Draft: feat: add lit dapater packages#59

Open
fredericbahr wants to merge 2 commits intoTanStack:mainfrom
fredericbahr:feat-lit-adapter
Open

Draft: feat: add lit dapater packages#59
fredericbahr wants to merge 2 commits intoTanStack:mainfrom
fredericbahr:feat-lit-adapter

Conversation

@fredericbahr
Copy link

🎯 Changes

Add Lit Adapter for Hotkeys

✅ 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).

@fredericbahr fredericbahr changed the title feat: add lit dapater packages Draft: feat: add lit dapater packages Mar 9, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c2183d968

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

// Register the hotkey
registration = manager.register(sequence, descriptor as HotkeyCallback, {

Choose a reason for hiding this comment

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

P1 Badge Register the decorated method instead of the descriptor object

hotkeySequence currently passes descriptor to manager.register as if it were a callback, but SequenceManager later invokes registration.callback(event, context), so sequence matches will fail at runtime with a non-function callback. This should register the method function (typically descriptor.value) bound to the current element instance, otherwise @hotkeySequence is effectively broken.

Useful? React with 👍 / 👎.

proto.disconnectedCallback = function () {
originalDisconnected.call(this)

if (registration.isActive) {

Choose a reason for hiding this comment

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

P1 Badge Check registration exists before reading isActive on teardown

connectedCallback can return before registration is created (for example when target resolves to null, or in environments without document), but disconnectedCallback always reads registration.isActive. In those cases teardown throws because registration is undefined, so components that intentionally skip registration crash on disconnect.

Useful? React with 👍 / 👎.

const originalConnected = proto.connectedCallback
const originalDisconnected = proto.disconnectedCallback

let registration: HotkeyRegistrationHandle

Choose a reason for hiding this comment

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

P1 Badge Track hotkey registration per element instance

The registration handle is stored in decorator closure state on the prototype, so all instances of a decorated component share one mutable handle. When multiple instances mount, later mounts overwrite earlier handles; unmounting one instance can unregister another instance’s hotkey and leak the first one. Store registrations on this (or a WeakMap keyed by instance) so lifecycle cleanup is instance-safe.

Useful? React with 👍 / 👎.

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.

2 participants