Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek/deepseek-v4-pro· deepseekHugging 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.

    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. DeepSeek Assistant

    Let me start by understanding the repository structure and the issue. The issue is about a Teleport component inside a Suspense that crashes when unmounted before its mount can run. The error is:

    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)
    

    The problem is that in TeleportImpl.remove, when unmounting teleport children, some children might have vnode.component === null (because they were pending mounts that never got mounted), and the code tries to call unmountComponent on them without checking for null.

    Let me explore the repository structure and find the relevant code.

  3. DeepSeek Assistant

    This is the Vue.js core repository. Let me find the relevant file - the Teleport implementation.

  4. DeepSeek Assistant

    Let's look at the Teleport.ts file, which should contain the TeleportImpl implementation.

  5. DeepSeek Assistant

    Now let me look at the unmount function in the renderer to understand the crash

  6. DeepSeek Assistant

    Let me look at the unmount function and unmountComponent function to understand the crash.

  7. DeepSeek Assistant

    Let me use grep to view the relevant lines.

  8. DeepSeek Assistant

    Let me look at unmountComponent to see how it accesses `component.type

  9. DeepSeek Assistant

    Now let me see the full remove method in Teleport.ts

  10. DeepSeek Assistant

    Let me see the full remove function.

  11. DeepSeek Assistant

    Now I have a clear understanding of the issue. Let me first check if there are existing tests I can look at.

  12. DeepSeek Assistant

    Let me first try to run the existing Teleport tests and see if there are any failures.

  13. DeepSeek Assistant

    Let me create a reproduction script to confirm the issue

  14. DeepSeek Assistant

    Let me run the reproduction script using vitest.

  15. DeepSeek Assistant

    Let me create the test inside the proper test directory.

  16. DeepSeek Assistant

    Let me run this test to see if it reproduces the crash.

  17. DeepSeek Assistant

    The test needs jsdom. Let me look at how other tests handle this and adjust the test.

  18. DeepSeek Assistant

    Let me update the repro test with the proper environment directive and imports

  19. DeepSeek Assistant

    Now let's run the test again

  20. DeepSeek Assistant

    The test passes because Suspense resolves immediately. I need to create a test with an async component that keeps the Suspense in a pending state. Let me look at how Suspense's pendingBranch

  21. DeepSeek Assistant

    Let me look at the Suspense code around line 493

  22. DeepSeek Assistant

    Let me update the test to properly reproduce the crash with an

  23. DeepSeek Assistant

    Let me simplify - use the defer prop on Teleport instead, which triggers the same code

  24. DeepSeek Assistant

    Let me run this test to see if it reproduces the crash

  25. DeepSeek Assistant

    Let me understand when the post-render effect runs. Let me check queuePostRenderEffect

  26. DeepSeek Assistant

    Let me check line 292 to understand queuePostRenderEffect:

  27. DeepSeek Assistant

    Let me check queueEffectWithSuspense

  28. DeepSeek Assistant

    Let me check queueEffectWithSuspense in scheduler.ts

  29. DeepSeek Assistant

    Let me search for its definition more broadly

  30. DeepSeek Assistant

    Let me look at queueEffectWithSuspense in Suspense.ts

  31. DeepSeek Assistant

    Now I understand. Let me create a proper test that reproduces the crash:

  32. DeepSeek Assistant

    Let me run this test

  33. DeepSeek Assistant

    Let me understand the flow better by examining how parentSuspense flows to Teleport

  34. DeepSeek Assistant

    Let me look at the patch function to understand how parentSuspense is determined:

  35. DeepSeek Assistant

    Let me look at how processComponent passes parentSuspense

  36. DeepSeek Assistant

    Let me look at `processComponent

  37. DeepSeek Assistant

    Let me add some debug logging to understand the flow better

  38. DeepSeek Assistant

    I see - my test doesn't have an async component in the Suspense default slot. Let me fix:

  39. DeepSeek Assistant

    Let me run this test:

  40. DeepSeek Assistant

    Let me look at how the Suspense unmount works

  41. DeepSeek Assistant

    Let me look at the Suspense.unmount function at line 780

  42. DeepSeek Assistant

    Let me check if mountChildren passes parentSuspense through

  43. DeepSeek Assistant

    Let me find mountChildren

  44. DeepSeek Assistant

    Let me look at mountChildren

  45. DeepSeek Assistant

    Let me add temporary debug logging to verify the flow

  46. DeepSeek Assistant

    Let me add debug logging to Teleport.ts temporarily

  47. DeepSeek Assistant

    Let me temporarily add debug logs to understand the flow

  48. DeepSeek Assistant

    Let me run the test with debug output

  49. DeepSeek Assistant

    I see - the children are a slots object, not an array. Let me modify the test to use array children (like a compiled template would

  50. DeepSeek Assistant

    Let me run this test

  51. DeepSeek Assistant

    I've successfully reproduced the crash. Now let me implement the fix. The issue is in TeleportImpl.remove - when a pendingMount is found, it should skip unmounting children because they were never mounted.

  52. DeepSeek Assistant

    Now let me look at the exact code to fix in TeleportImpl.remove

  53. DeepSeek Assistant

    Now I'll fix the code. The comment says "skip removing children" but the code doesn't actually skip. I need to add a check to skip children unmount when pendingMount exists

  54. DeepSeek Assistant

    Let me open the file

  55. DeepSeek Assistant

    Let me try the open command with the proper syntax

  56. DeepSeek Assistant

    Now let me make the fix. I need to guard the children unmount loop with a !pendingMount check:

  57. DeepSeek Assistant

    Let me use the replace command instead

  58. DeepSeek Assistant

    Let me use the multi-line syntax for replace

  59. DeepSeek Assistant

    Now let me update the comment to reflect the new behavior

  60. DeepSeek Assistant

    Now let me run the reproduction test to verify the fix

  61. DeepSeek Assistant

    The fix works. Now let me run the existing Teleport tests to make sure nothing is

  62. DeepSeek Assistant

    All 51 Teleport tests pass. Let me also run the Suspense tests

  63. DeepSeek Assistant

    All tests pass. Let me clean up the temporary test file and verify the final diff

  64. DeepSeek Assistant

    Let me verify the final diff

  65. DeepSeek Assistant

    The diff is clean. Let me run the full runtime-core test suite to make sure nothing is

  66. DeepSeek Assistant

    All 1014 tests pass. Let me verify my checklist:

    Checklist

    1. ✅ Reproducing the error: I successfully reproduced the exact crash from the issue - TypeError: Cannot read properties of null (reading 'type') at unmountComponent called through TeleportImpl.remove.

    2. ✅ Fix resolves the error: After the fix, the reproduction test passes without any crash.

    3. ✅ Edge cases considered:

      • Teleport with no children: handled by the existing shapeFlag & ShapeFlags.ARRAY_CHILDREN check
      • Disabled teleport: the shouldRemove logic remains unchanged, only children unmount is guarded
      • Nested teleports: each teleport independently checks its own pendingMounts entry
      • defer prop without Suspense: the mount job is still stored in pendingMounts and the guard works the same way
      • The fix mirrors the exact same pattern already used in moveTeleport (line 397: !pendingMounts.has(vnode)) from PR #14702
    4. ✅ Existing tests pass: All 1014 runtime-core tests pass, including all 51 Teleport tests and all 57 Suspense tests.

    The fix is minimal and consistent with the existing codebase patterns.

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