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 understanding the Teleport/Suspense unmount crash described in the issue.
- Assistant
Let me examine the Teleport implementation and related test files.
- Assistant
Let me look at the Teleport.ts file, especially the remove and unmount related code.
- Assistant
Let me look at the remove function and the pendingMounts-related code.
- Assistant
Let me read the remove function carefully.
- Assistant
Let me examine the unmount and unmountComponent functions to understand the null component crash.
- Assistant
Let me look at the full unmount function.
- Assistant
Let me open the unmount function.
- Assistant
Let me look at unmountComponent next.
- Assistant
Let me look at how pending mounts are set up during process.
- Assistant
I need to read Teleport.ts around the mount logic.
- Assistant
Looking at more of the mount path with pending suspense.
- Assistant
The fix is clear: skip unmounting children entirely when the teleport never mounted. Checking existing tests and related commits next.
- Assistant
Let me look at the related PRs/commits and tests for pendingMount Director/Suspense phones.
- Assistant
Let me look at the test cases added by PR #14642 and #14702, and see if there's a reproduction in the reproduction repo or we need to create one.
- Assistant
I'll write a temporary vitest reproduction matching the crash reported in the issue.
- Assistant
Let me check how teleport el is removed during unmount.
- Assistant
I'll implement the fix by skipping children unmount when the teleport never mounted, then write a reproduction.
- Assistant
I'll navigate to the relevant line and apply the edit.
- Assistant
Now I can apply the edit.
- Assistant
Cleaning up the unused
shouldRemove = falseassignment now that we skip the children loop on pending mount. - Assistant
I'll write a temporary reproduction test based on the issue crash scenario.
- Assistant
I'll create a temporary reproduction to verify the crash and the fix.
- Assistant
Creating a temporary test to reproduce the crash scenario.
- Assistant
Verifying the reproduction against the unfixed code first.
- Assistant
The test timed out — checking package.json scripts for the correct way to run tests.
- Assistant
Checking stash status and retrying the test run.
- Assistant
Running the reproduction against the unfixed code.
- Assistant
Vitest is hanging — I'll try a simpler isolated approach.
- Assistant
Checking for hung vitest processes and environment issues.
- Assistant
Let me try running vitest with more verbose output and see what happens without piping.
- Assistant
Corepack is blocking the download — I'll invoke the local vitest binary directly instead.
- Assistant
Running the reproduction without the fix.
- Assistant
The crash matches the issue. Restoring the fix and re-running the tests.
- Assistant
Running the reproduction tests with the fix applied.
- Assistant
All repro tests pass. Running existing Teleport and Suspense tests next.
- Assistant
Also covering the deferred teleport (
deferprop) unmount path with a component child. - Assistant
Removing the temporary repro file, then reviewing the final diff.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.