You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(#2675): keep re-rendering root component after another wrapper is mounted - #2890
shallowMount/mount install a vnode transformer via Vue's global transformVNodeArgs, which is last-call-wins: mounting a second wrapper replaces the first wrapper's transformer. That transformer only treats its own root component as "don't stub", so when an earlier wrapper later re-renders (e.g. via setProps), its root no longer matches and gets stubbed. The DOM keeps the old output and setProps looks like it does nothing.
That's why the issue only appears when a wrapper declared outside the test is reused across several tests, and mostly with shallowMount, where stubbing is active.
The fix tracks every mounted root component in a module-level WeakSet and treats any of them as a root in isRootComponent. It stays gated by !instance.parent, so genuine child components are still stubbed as before. Only a re-rendered root is spared.
Added a shallowMount test that mounts a second wrapper and then calls setProps on the first one. It fails on main (renders initial) and passes with this change (renders updated).
I don't think this really fixes the linked issue, as there is no usage of enableAutoUnmount in #2675
And the issue occurs with shallowMount but not with mount
lazerg
changed the title
fix(#2675): throw helpful error when setProps is called on an unmounted wrapper
fix(#2675): keep re-rendering root component after another wrapper is mounted
Jun 23, 2026
You're right, thanks for the repro. My first attempt misread the issue (no enableAutoUnmount involved).
Real cause: shallowMount's vnode transformer is installed via Vue's global transformVNodeArgs, which is last-call-wins. Mounting a second wrapper replaces the first's transformer, and the new one only spares its own root from stubbing. So re-rendering the first wrapper via setProps stubs its root and the DOM keeps the old value (hence shallowMount-only, and only after a second mount).
Pushed a fix that tracks every mounted root in a WeakSet and treats any of them as root in isRootComponent (still gated by !instance.parent, so real children stay stubbed). Added a test that fails on main and passes with the change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2675
shallowMount/mountinstall a vnode transformer via Vue's globaltransformVNodeArgs, which is last-call-wins: mounting a second wrapper replaces the first wrapper's transformer. That transformer only treats its own root component as "don't stub", so when an earlier wrapper later re-renders (e.g. viasetProps), its root no longer matches and gets stubbed. The DOM keeps the old output andsetPropslooks like it does nothing.That's why the issue only appears when a wrapper declared outside the test is reused across several tests, and mostly with
shallowMount, where stubbing is active.The fix tracks every mounted root component in a module-level
WeakSetand treats any of them as a root inisRootComponent. It stays gated by!instance.parent, so genuine child components are still stubbed as before. Only a re-rendered root is spared.Added a
shallowMounttest that mounts a second wrapper and then callssetPropson the first one. It fails onmain(rendersinitial) and passes with this change (rendersupdated).