Teleport + Suspense: unmount crashes on pending teleport with component child…
- User
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/Suspense unmount paths and existing regression tests, then add the smallest guard with a focused test and run the relevant runtime-core suite.
- Assistant
rgisn’t installed in this checkout, so I’m switching tofind/grepand checking repository guidance plus the current worktree before editing. - Assistant
The failure is in
TeleportImpl.remove: it cancels the pending mount and suppresses host-node removal, but still recursively unmounts children that were never mounted. I’m adding a regression test that uses an unresolved Suspense branch and a component as the Teleport child, then I’ll make child teardown conditional on whether the Teleport mount ever ran. - Assistant
The regression test now reproduces the exact null-component crash. The implementation change skips recursive child unmount only while that Teleport still has a queued mount; normal mounted and disabled Teleports retain their existing teardown behavior.
- Assistant
The focused suite and all runtime-core unit tests pass (1,015 tests). I’m finishing with the repository-wide TypeScript check and a clean-diff validation.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.