Skip to content

Wasted Rendering #1181

@zeng450026937

Description

@zeng450026937

Version

3.0.0-beta.12

Reproduction link

https://jsfiddle.net/450026937/whdtnqgk/32/

Steps to reproduce

  1. Have child component with props declaration, but without using it in render function
  2. Have parent component using it with props binding, like :key="value"
  3. Update the "value" in parent component, and will trigger parent component update

What is expected?

Parent component update without calling child component's render function, as child component has it's own render effect.

What is actually happening?

Child component's render function is also invoked, but nothing changed with the node tree.


After looking into the source code, maybe we should split out the processing of parent update & self update in setupRenderEffect().
Making attrs shallow reactive like props will be a good idea, which allow just update child component's attrs & props(also fallthroughAttrs) during parent component update, and leaving child component trigger it's update if needed.
If this is not possible, an additional lifecycle hook, "shouldUpdateCompoent" should be needed to avoid wasted rendering.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions