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 start by exploring the repository structure and locating the Teleport/Suspense-related code to reproduce the unmount crash.
- Assistant
I'll inspect the Teleport implementation and related tests next.
- Assistant
Let me read the Teleport.ts file, especially the remove function and pendingMount related code.
- Assistant
Let me read more of the file, focusing on the remove function and pending mounts.
- Assistant
Let me look at the remove function specifically.
- Assistant
The crash is likely from
unmountstill running on never-mounted component children—I'll check that path. - Assistant
Let me search for the unmount function more specifically.
- Assistant
Let me look at the unmount and unmountComponent functions.
- Assistant
I'll inspect how pending mounts are created and how tests cover this case.
- Assistant
I'll open Teleport.ts at the pending-mount setup and check the related tests.
- Assistant
Let me look for suspense-related teleport tests and the PRs mentioned.
- Assistant
There's a test for #14701 in Suspense.spec.ts—I'll inspect that and nearby coverage.
- Assistant
Let me look for tests related to #14640 and unmount of pending teleports.
- Assistant
I'll check how regular unmount reaches teleport remove and cleans up anchors.
- Assistant
I'll inspect the update path when a mount is still pending.
- Assistant
I'll check how remove handles teleport vnodes.
- Assistant
I'll reproduce the crash with a minimal test script next.
- Assistant
I'll write a temporary script that reproduces the teleport unmount crash.
- Assistant
I'll add a temporary Suspense test that hits the unmount crash path.
- Assistant
I'll jot a temporary vitest case that matches the crash path and run it.
- Assistant
I'll create a temporary repro test with a component child in the teleport.
- Assistant
I'll run the temporary reproduction test now.
- Assistant
The previous run timed out; I'll try invoking vitest directly.
- Assistant
The crash is reproduced. I'll skip unmounting children when the teleport mount is still pending.
- Assistant
I'll early-return from remove when a pending mount exists so children are never unmounted.
- Assistant
I'll re-run the reproduction and the related teleport/suspense tests.
- Assistant
I'll expand the temporary cases and run Teleport plus full Suspense unit tests.
- Assistant
I'll cover deferred teleport unmount as another edge case too.
- Assistant
There's already a test
should not mount discarded teleport after deferred updates. Let me check ifthose use component children. - Assistant
Next I'll run the extended TEMP REPRO cases plus the full Teleport and Suspense suites.
- Assistant
All tests passed. I'll remove the temporary reproduction tests next.
- Assistant
I need to find where TEMP tests end and restore to original content.
- Assistant
I need to delete lines 2613-2751 (the blank line after 2612 and all TEMP tests, keep //#11617)
- Assistant
I'll restore the test file with git and quantum-check the final Teleport diff.
- Assistant
I'll check whether hydration can leave a pending mount with target anchors still set.
- Assistant
I'll also clean up target anchors defensively on the pending early-return path.
- Assistant
I'll open Teleport.ts and reapply the defensive target-anchor cleanup.
- Assistant
I'll leave the early-return as-is and re-run the Suspense and Teleport unit suites.
- Assistant
I'll run one last external repro script so we don't touch the test files.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.