Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-opus-5· anthropicHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Teleport + Suspense: unmount crashes on pending teleport with…

  1. 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)

    pnpm dev
    
    1. Open the browser DevTools console.
    2. Click "Unmount Suspense".
    3. Observe TypeError: Cannot read properties of null (reading 'type') in the console

    Option 2 — Tests (additional)

    pnpm test
    

    The repo also contains three Vitest tests in tests/teleport-unmount.test.js

    What 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:

    TypeError: 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

    System:
        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
    

    Any additional comments?

    This is a continuation of the regression chain that started in 3.5.31:

    • PR #8619 (3.5.31) introduced pendingMounts so teleports defer their mount when parentSuspense.pendingBranch is set. This is what created the situation where a teleport's children can have vnode.component === null.
    • Issue #14640 + PR #14642 (3.5.32) added the pendingMount check shown above. That gates DOM removal of element children, not the unmountComponent(null, …) call on component children.
    • Issue #14699 (3.5.32) reported the same crash with the same stack as this issue. Closed by the author with a note about re-filing with a more accurate reproduction.
    • Issue #14701 + PR #14702 (3.5.33) added pendingMounts.has(vnode) guard, but only in moveTeleport. The TeleportImpl.remove path was not touched, so 3.5.33 and 3.5.34 still crash.

    Interface

    No new interfaces are introduced.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /core, current file: none) bash-$

  2. Claude Assistant

    I'll use the editor instead.

  3. Claude Assistant

    The fix is complete. Final diff in packages/runtime-core/src/components/Teleport.ts: when a teleport still has a queued (pending) mount job at unmount time, nothing of its content was ever mounted, so besides disposing the job we now skip unmounting its children entirely (previously we only suppressed DOM removal, which still called unmountComponent(null, …) on component children → TypeError: Cannot read properties of null (reading 'type')).

    Checklist:

    • "If an error was reported in the issue description, I have successfully reproduced it." — Done. I wrote a temporary spec (Suspense with pending async dep + Teleport containing a component child, unmounted before resolve) and got exactly the reported failure with the same stack: TypeError: Cannot read properties of null (reading 'type') at unmountComponent ← TeleportImpl.remove ← Suspense unmount.

    • "If an error was reported in the issue description, I have confirmed that my fix resolves the error." — Done. After the change the same repro passes (root and teleport target both end up empty, no crash).

    • "I have thought about edge cases and made sure my fix handles them as well." — Considered and verified: (1) defer teleport unmounted before its post-flush mount; (2) nested pending teleports (no leaked jobs, because inner process() never runs when the outer mount is pending, hence no inner pendingMounts entry); (3) disabled pending teleport with component child removed while Suspense is pending; (4) fallback branch teleport that did mount and then gets unmounted on Suspense.resolve (normal path still unmounts children/removes anchors properly); (5) the patch path where a pending mount is transferred from n1 to n2 — a pendingMounts entry always implies "never mounted", so skipping child unmount is always safe. I also kept the existing shouldRemove semantics untouched for the non-pending path.

    • "I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass." — Done. Teleport.spec.ts, Suspense.spec.ts, all runtime-dom tests, and the whole runtime-core + packages/vue unit suites pass (1044 passed). The only failures are the puppeteer-based e2e files, which fail for an environment reason (“Running as root without --no-sandbox is not supported”), unrelated to this change. Prettier check and tsc --noEmit are clean. All temporary repro spec files were deleted; no repository tests were modified or added.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.