Skip to content

Calling a slot's render function causes components to not be properly unmounted in certain conditions #12371

Closed
@Llois41

Description

@Llois41

Vue version

3.5.12

Link to minimal reproduction

https://play.vuejs.org/#eNqtVG1v0zAQ/iu3gNRuahNB4cvoNhhMYkiMCca3SMwkl8Sba0e207Wq+t85Oy9tUTvlw/Il9r0+d37uVsGnsgznFQanwdQkmpcWDNqqBMFkfhYH1sTBeSz5rFTawgo0ZrCGTKsZDMht8KHTfVb0lyjtXcHstblR9larErVYfkFjtVpi2viFUQ9bB2or+i3LsXN3l1Yfy0RJY0FJOHPohhkTBo9JM43qggg+XSzOSsEs0g1gmvI5JIIZQyVSB3yNQN/0b2UthfqYCJ48ktKHPVKSLO5UnguEkpJPo9rOh/Z+Ht98zDPv08UjTZsYXhXIUsFlDaHRFpPzr414GtGlc4u2AO+JRUVb6t92qD4PEO1PUAtcDXV7IuoPnXZsghGRgdJmPA8fjJLEmJUzjoOEEnOB+kdpOb1FHJyC1zgdE0I9ffMyqysctfKkwORxj/zBLJwsDm41GtRzjINOZ5nO0dbqq183uKBzp5yptBJk/YzyJxolKoexNrusZEqwt+w82mvPOC7zO3O1oCabtigH1FmuvX0cEANdzw+VvoE7Cd95v1iuqYste93I7bLSYOLCdMx0lhtqHo3H8MRtoSoLtuDG020E9z3e/R5OuDmBspFD2k1ZGMJ43GYoJi2F/RBRatRa6YaYh2EgGb8oEDeeddgNX11en++JGagMkZn+JaPdoDJg4AkF3B2NUNZbpZjRXKWgNBR0pV7bJTSTYzbpAFYreO28TNjO6EU4PIYLekWiIziyLOm/phfs8Pgsks2Q2tXEJJN2wNoRcqfmWfcMVM892Hc5K3mJmdL4W85UJe2oE3x31//3dix31EMq+OzctYemBEOh8uGgJ77dPINjt3030Rs0LxG/CVVn6LvfeyShNvawOrQW/8xRuyVBzzQJ34dv3gbrfxQQfl4=

Steps to reproduce

  1. Open reproduction link
  2. Open browser console
  3. Toggle the button
  4. See in the console, that the component's ComponentThatIsNotProperlyDestroyed onBeforeUnmount hook was not called

Switching between the versions in the playground, you can see that it still works as expected in 3.4.31 and does not work anymore after 3.4.32.

What is expected?

ComponentThatIsNotProperlyDestroyed gets unmounted correctly (including the lifecycle hooks being called).

What is actually happening?

In our application, we are using vuex and vue-router.
After updating vue from 3.4.31 to 3.4.32, we observe that some component's computed properties or event listeners are still getting called despite they are not even in the DOM anymore. After updating to 3.5.12 most of the problems went away but we could still reproduce one example and made the reproduction repo above.

System Info

No response

Any additional comments?

Is it intended that the slot rendering function is called by the application code?

We are evaluating to replace this call. But we still wanted file this issue since it only occurs in combination with the v-if="false"/v-else pattern (see comments in Page.vue in the reproduction link).

Metadata

Metadata

Assignees

No one assigned

    Labels

    ❗ p4-importantPriority 4: this fixes bugs that violate documented behavior, or significantly improves perf.regression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions