Skip to content

Bug: Component is not re-rendered after changing props when a recursive component is rendered #2039

Closed
@Sumolari

Description

@Sumolari

Describe the bug

In render trees where there is a recursive component being rendered, changing the props of the root component does not re-render the component tree. This was introduces in version 2.3.1.

To Reproduce
https://stackblitz.com/edit/vitest-dev-vitest-mbp4xz?file=test/basic.test.ts

Expected behavior
When the props of the root component change, the children that receive those props should be updated, too, regardless of any other component being recursive or not.

Related information:
The issue can be reproduced in @vue/test-utils v2.3.1, v2.3.2 and v2.4.0-alpha.0. The issue does not affect v2.3.0.

  System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  npmPackages:
    @vue/test-utils: 2.3.1 => 2.3.1 
    vitest: latest => 0.30.1 
    vue: latest => 3.2.47 

Additional context
Note that the issue is about non-recursive components not being updated when part of a tree that also includes other recursive-components, even if the non-recursive components are direct children of the root component.

In the test scenario I'm trying to render a simple folder structure like this one:

- Root
    - The Folder
    - The File

Where both Root and The Folder and FolderItem components while The File is a FileItem component. The test first renders the tree without passing an icon prop and then changes the icon prop to a different value. The icon prop is passed directly to both FolderItem and FileItem components.

I was expecting FileItem to be updated and finding the new value of the prop when calling its .props('item'). This is what happens in @vue/test-utils v2.3.0 and also what happens in all versions when I don't try to render any other FolderItem component in that tree.

However, when I render another FolderItem component, in @vue/test-utils v2.3.1 and later the FileItem component never gets updated and the test always get the original value for the item prop.

I believe this is a regression: even if all FolderItem instances but the root one are stubbed, the FileItem component is a direct child of the root FolderItem so I don't think it should be affected by its sibling being stubs or not. Please, correct me if I misunderstood something and this is actually the intended behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions