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
Let me inspect the Teleport implementation and the related fix history.
- Assistant
Let me read the Teleport.ts file, especially the remove function.
- Assistant
Let me look at the remove and process functions more carefully.
- Assistant
Let me read the remove function and surrounding code carefully.
- Assistant
Let me read the remove function.
- Assistant
Let me examine the unmount path for components when children were never mounted.
- Assistant
Let me read the unmount and unmountComponent functions.
- Assistant
Let me check what happens after Teleport.remove is called during unmount.
- Assistant
Let me check how the Teleport element is removed.
- Assistant
Let me look at the existing Teleport tests and recent related commits.
- Assistant
Let me inspect the pending-mount unmount handling from PR #14642 and related tests.
- Assistant
Let me look at existing Suspense+Teleport tests covering this crash scenario.
- Assistant
The bug is clear: with a pending mount, children were never mounted, so we should skip unmounting them instead of only setting
shouldRemove = false. - Assistant
I need to open the file at the right location first.
- Assistant
Now I can apply the replace.
- Assistant
I'll look at existing Suspense+Teleport tests and write a temporary reproduction script.
- Assistant
I'll create a temporary reproduction test matching the reported failure scenario.
- Assistant
I'll create a temp test file based on the issue and the existing Suspense+Teleport patterns.
- Assistant
Let me check how tests are run and whether a build is needed.
- Assistant
Let me run the reproduction tests with vitest.
- Assistant
The previous command timed out; I'll retry the copy and run steps separately.
- Assistant
Let me check vitest config for projects.
- Assistant
Let me run the tests with navbar of project
- Assistant
Vitest may be hanging — I'll try running it differently.
- Assistant
The crash is gone — failing assertions are only about the null-render comment placeholder. I'll fix those and re-run.
- Assistant
I'll temporarily revert the fix to confirm the tests reproduce the original crash.
- Assistant
python3 is missing — I'll use node to revert temporarily.
- Assistant
Confirmed the original crash. Restoring the fix and removing the temporary test file.
- Assistant
Let me verify the final diff and double-check the fix is applied correctly.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.