Skip to content

Hot reload: Unhandled error during execution of scheduler flush (TypeError: parent is null) #599

Open
@bisgardo

Description

@bisgardo

Related plugins

Describe the bug

Hot reload "fails" under a certain condition:

Consider the Vue component hierarchy

App
- Outer
  - Inner

Both Outer and Inner imports a file service.js. When running with npm run dev, editing that file triggers hot reload which logs the following warning and error:

[Vue warn]: Unhandled error during execution of scheduler flush
  at <Inner>
  at <Outer>
  at <App> runtime-core.esm-bundler.js:51:12
Uncaught (in promise) TypeError: parent is null
   ...

Besides the error being logged, I didn't observe anything actually breaking. Reproduced in Firefox and Chrome on macOS.

SSCCE

Based on scaffolding using npm create vite@latest.

main.js

import App from './App.vue';
import { createApp } from 'vue';

createApp(App)
  .mount('#app');

App.vue

import App from './App.vue';
import { createApp } from 'vue';

createApp(App)
  .mount('#app');

Outer.vue

<script setup>
import './service.js';
import Inner from './Inner.vue';
</script>

<template>
  <Inner/>
</template>

Inner.vue

<script setup>
import './service.js';
</script>

<template>
  Contents...
</template>

service.js: Anything...

Reproduction

https://github.com/bisgardo/vue-vite-hotreload-bug-example

Steps to reproduce

  1. Run npm run dev
  2. Make any edit to service.js.
  3. Observe warning and error being dumped in the Browser's console.

System Info

System:
    OS: macOS 15.5
    CPU: (11) arm64 Apple M3 Pro
    Memory: 126.92 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.9.0 - ~/.asdf/installs/nodejs/22.9.0/bin/node
    npm: 10.8.3 - ~/.asdf/installs/nodejs/22.9.0/bin/npm
  Browsers:
    Chrome: 137.0.7151.69
    Safari: 18.5
  npmPackages:
    @vitejs/plugin-vue: 5.2.4 => 5.2.4 
    vite: 6.3.5 => 6.3.5

Used Package Manager

npm

Logs

[Vue warn]: Unhandled error during execution of scheduler flush
  at <Inner>
  at <Outer>
  at <App> runtime-core.esm-bundler.js:51:12
Uncaught (in promise) TypeError: parent is null
    insert runtime-dom.esm-bundler.js:28
    processText runtime-core.esm-bundler.js:4774
    patch runtime-core.esm-bundler.js:4688
    componentUpdateFn runtime-core.esm-bundler.js:5353
    run reactivity.esm-bundler.js:237
    setupRenderEffect runtime-core.esm-bundler.js:5481
    mountComponent runtime-core.esm-bundler.js:5256
    processComponent runtime-core.esm-bundler.js:5209
    patch runtime-core.esm-bundler.js:4727
    componentUpdateFn runtime-core.esm-bundler.js:5433
    run reactivity.esm-bundler.js:227
    reload runtime-core.esm-bundler.js:529
    callWithErrorHandling runtime-core.esm-bundler.js:199
    flushJobs runtime-core.esm-bundler.js:408
    promise callback*queueFlush runtime-core.esm-bundler.js:322

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: hmrp3-minor-bug 🔨An edge case that only affects very specific usage (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions