fix(hotkeys): Don't start recording without a document, and clean up Svelte recorders in early-destroyed roots #208
Merged
KevinVandymerged 1 commit into
main fromrefs/pull/208/head·merged by KevinVandy Follow-up to #207, fixing two valid CodeRabbit comments that came in after merge.
Changes#
HotkeyRecorder.start()does nothing without adocument. It used to add the recorder to the shared recording set regardless. Svelte's$effectteardown (from #207) and Vue'sonScopeDisposenever run during a server render, so a recorder started there stayed in the set and suspended hotkey dispatch for the rest of the process. The fix is in core, so it covers every adapter.- The Svelte recorder registers its teardown with
$effect.pre.$effectis queued, so an$effect.rootdestroyed before effects flushed never got the teardown, and a recording started in that window kept listening and callingonRecord.$effect.preruns as soon as it's created.createHotkeysdoesn't need this, because it only registers inside an effect.
Skipped the optional Vue DOM-shim SSR nitpick: that path behaves the same as before #207.
Testing#
- New core test (node environment):
start()leavesisRecordingfalse and suspends nothing. - New Svelte test: a recorder started in a root destroyed before flush doesn't record.
- Both failed before the fix. Lint, types, tests for all packages, build with size limits, and the clean-clone Intent maintainer check pass.
- 1
Caution
Review failed#
The pull request is closed.
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment `@coderabbitai help` to get the list of available commands.-
KevinVandy merged thisd43b9aa
KevinVandy closed this
🚀 Changeset Version Preview#
16 package(s) bumped directly, 2 bumped as dependents.
🟨 Minor bumps#
Package Version Reason @tanstack/alpine-hotkeys0.6.0 → 0.7.0 Changeset @tanstack/react-hotkeys0.17.0 → 0.18.0 Changeset @tanstack/react-hotkeys-devtools0.11.1 → 0.12.0 Changeset 🟩 Patch bumps#
Package Version Reason @tanstack/angular-hotkeys-devtools0.3.1 → 0.3.2 Changeset @tanstack/ember-hotkeys0.6.0 → 0.6.1 Changeset @tanstack/hotkeys0.18.0 → 0.18.1 Changeset @tanstack/hotkeys-devtools1.6.0 → 1.6.1 Changeset @tanstack/lit-hotkeys0.18.0 → 0.18.1 Changeset @tanstack/preact-hotkeys0.17.0 → 0.17.1 Changeset @tanstack/preact-hotkeys-devtools0.11.1 → 0.11.2 Changeset @tanstack/solid-hotkeys0.17.0 → 0.17.1 Changeset @tanstack/solid-hotkeys-devtools0.11.1 → 0.11.2 Changeset @tanstack/svelte-hotkeys0.17.0 → 0.17.1 Changeset @tanstack/svelte-hotkeys-devtools0.3.1 → 0.3.2 Changeset @tanstack/vue-hotkeys0.17.0 → 0.17.1 Changeset @tanstack/vue-hotkeys-devtools0.11.1 → 0.11.2 Changeset @tanstack/angular-hotkeys0.17.0 → 0.17.1 Dependent @tanstack/octane-hotkeys0.7.0 → 0.7.1 Dependent
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: 0bcaa4ac68b0149708ae06635216109b5f6fec53
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR