Skip to content

[Space] children items with v-if and v-show rerender on every toggle #6500

@Meowu

Description

@Meowu
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.3.0-beta.4

Environment

Vue 3.2.36

Reproduction link

Edit on CodeSandbox

Steps to reproduce

open the sandbox:

  1. click Toggle button
  2. check the console
  3. TestA and TestB always rerender on every toggle, although they are used with v-show

What is expected?

Children components of Space do not rerender on every toggle.

What is actually happening?

Children components with v-show always rerender, so they will lost their internal state.

This only happens when the children have both v-if and v-show. The children with v-show should not rerender.


I explored the source code, and found that if I change

const items = filterEmpty(slots.default?.());

to

const items = slots.default?.()

the problem disappeared.

But I don't think this is the reason.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions