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
Now let's check the repo linked in the issue for the tests. Let's try to reproduce with a quick script using vitest or a temp test in the runtime-core test directory (but not committing it).
Assistant
No python3 available. Let me edit with a script using node or manual replace command.
Assistant
Now let's check without the fix to confirm crash.
Assistant
This exactly reproduces the crash from the issue. Now let's restore the fix.
Assistant
Fix confirmed. Now let's run the existing Teleport and Suspense test suites to make sure nothing breaks, then remove the temp test file.
Assistant
All existing tests pass. Let's run the full runtime-core test suite for a broader check, and also runtime-dom tests related to teleport.
Assistant
All tests pass. Now let's remove the temporary test file, and also double check the final diff.
Assistant
This is a clean, focused fix. Let me also verify the build/typecheck passes.
Assistant
No dedicated tsc typecheck script for src; let's just run
tsc --noEmitat root using tsconfig.json to catch type errors in our edited file.Assistant
No type errors related to our file. Let's do a final full test run to be safe.
Assistant
All full unit tests pass. Let's confirm the final diff and check that no stray test file remains.
Assistant
Clean. Now let's go through the checklist.
Checklist review:
-
Reproduced the reported error – Yes. I built a minimal reproduction (Suspense with a synchronously-rendered component containing a with a component child, alongside a sibling async component that never resolves, then unmounting the whole tree before the async component resolves). With the original code, this threw exactly the reported error: at , with the exact same call stack shape described in the issue ( → → crash).
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.