ISSUE DESCRIPTION Teleport + Suspense: unmount crashes on pending teleport with…
- User
ISSUE DESCRIPTION
Teleport + Suspense: unmount crashes on pending teleport with component child (regression since 3.5.31)
Vue version
3.5.34
Link to minimal reproduction
https://github.com/pont1s/vue-teleport-unmount-crashes
Steps to reproduce
Option 1 — Browser (primary)
bashpnpm dev- Open the browser DevTools console.
- Click "Unmount Suspense".
- Observe
TypeError: Cannot read properties of null (reading 'type')in the console
Option 2 — Tests (additional)
bashpnpm testThe repo also contains three Vitest tests in
tests/teleport-unmount.test.jsWhat is expected?
When a inside a is unmounted before its mount can run, Vue should remove it cleanly. This worked correctly in 3.5.30.
What is actually happening?
In 3.5.31..3.5.34, unmounting such a teleport throws:
codeTypeError: Cannot read properties of null (reading 'type') at unmountComponent (runtime-core.cjs.js) at unmount at Object.remove (TeleportImpl.remove) at unmount at unmountChildren at unmount at unmountComponent at unmount at Object.resolve (Suspense)System Info
shellSystem: OS: macOS 26.3.1 CPU: (8) arm64 Apple M1 Memory: 102.19 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 24.15.0 - /Users/user/.local/state/fnm_multishells/14407_1779493498078/bin/node npm: 11.12.1 - /Users/user/.local/state/fnm_multishells/14407_1779493498078/bin/npm pnpm: 11.1.3 - /Users/user/.local/state/fnm_multishells/14407_1779493498078/bin/pnpm Browsers: Chrome: 148.0.7778.179 Safari: 26.3.1 npmPackages: vue: 3.5.34 => 3.5.34 - Assistant
I’ll trace the Teleport deferred-mount and removal paths, reproduce the failing scenario with the repository’s tests if available, then apply the smallest runtime fix and run the relevant test suite. I’ll avoid changing tests and will inspect the final diff before submission.
- Assistant
The source confirms deferred teleports are tracked in
pendingMounts, while the update path already cancels stale jobs. I’m now inspectingremoveand the renderer’s unmount contract to determine whether cancellation must happen before child unmounting or whether component children need a separate guard. - Assistant
The failure mechanism is precise:
TeleportImpl.removecancels a queued mount and setsshouldRemove = false, but still recursively callsunmounton its not-yet-mounted children. A component child hascomponent === null, so the renderer dereferences null inunmountComponent. Since the queued mount has not executed at all, the correct behavior is to remove only the teleport anchors and skip all child unmounting while that queue entry exists. - Assistant
The first edit attempt could not run because this environment has no
pythonexecutable; no file was changed. I’ll apply the same one-line condition with a shell-native replacement, then run the focused Suspense/Teleport tests. - Assistant
The one-line fix is now applied. The initial test command timed out before producing results (likely due the unsupported/extra CLI mode or startup), so I’m checking the local toolchain and will rerun Vitest through the repository’s configured executable with a focused reporter.
- Assistant
The focused regression-adjacent suites pass: 108 tests across Suspense and Teleport. The fix also preserves anchor cleanup and only suppresses child traversal when the teleport’s mount job is still pending, so already-mounted teleports retain normal unmount behavior. I’ll perform type/lint validation and inspect the final diff, then submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.