Repository navigation
fix(scroller): don't throw from destroy() before an element is set - #318
Merged
Merged
Conversation
`Scroller.destroy()` called `_scrollEnable()` unconditionally, which threw
`missing element` when no element had been set. `useScrollerControl({ el:
'self' })` only sets the element in `onMounted`, so unmounting it while a
`<Suspense>` boundary is still pending (e.g. navigating away during the
initial data load) threw from `onBeforeUnmount`.
Also stop `start()` from attaching listeners after the instance was
destroyed while it awaited `ready()`, which surfaced as an unhandled
rejection when destroying right after setting an element.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 6c047e9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Merged
dadajam4
added a commit
that referenced
this pull request
Oct 16, 2026
…322) Releasing @fastkit/scroller@1.0.1 (#318) did not release @fastkit/vue-scroller, since its `^1.0.0` range already admitted the new version. Add a patch changeset so its published range becomes `^1.0.1` and updating @fastkit/vue-scroller brings the fix along. Document when a fix in a dependency needs a changeset for its dependents too. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Summary
Two teardown bugs in
@fastkit/scroller, both reachable from@fastkit/vue-scroller.destroy()threwmissing elementwhen no element had been setuseScrollerControl({ el: 'self' })creates theScrollerwithout an element and only sets it inonMounted, but always callsdestroy()inonBeforeUnmount. When the component sits inside a<Suspense>boundary that is still pending, navigating away unmounts it before it ever mounted, anddestroy()→_scrollEnable()→_checkElement()threw. In an app that routes errors raised during navigation to an error page, this showed an error page.destroy()now only re-enables scrolling when an element exists.start()attached listeners afterdestroy()Setting an element kicks off
start(), which awaitsready()before attaching listeners. Destroying the instance in between madestart()resume on a destroyed instance and fail with an unhandled rejection (Cannot read properties of undefined (reading 'addEventListener')).start()now returns if the instance was destroyed while waiting.Tests
packages/scroller/src/__tests__/destroy.client.spec.ts:destroy()without an element;destroy()right after setting an element (captures unhandled rejections).packages/vue-scroller/src/composables/__tests__/scroller.client.spec.ts: unmounting auseScrollerControl({ el: 'self' })component while its<Suspense>boundary is pending.All three fail before the fix and pass after it.
Release
Changeset:
@fastkit/scrollerpatch (@fastkit/vue-scrollerfollows via internal dependency update).🤖 Generated with Claude Code