Unnecessary renders on parent update when $attrs is bound
See original GitHub issueVersion
2.6.10
Reproduction link
https://codepen.io/anon/pen/zQVRgG?editors=1010
Steps to reproduce
Type something into the first field
Uncomment line 8 or 14 then try again
What is expected?
In console:
Render a
What is actually happening?
In console:
Render a
Render b
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to prevent re-rendering of components that have not ...
I have a component that consists of several other components such as text fields, and when an input is made to the text...
Read more >Lightning - Rerender child components in aura:iterable after ...
I have a component (let's call it ParentComponent ) which has one main attribute -> object with nested objects within - attributes. I'm...
Read more >Optimizing React performance by preventing unnecessary re ...
This article explains how to update components only when necessary, and how to avoid common causes of unintentional re-renders. Use React.memo ...
Read more >Refs and the DOM - React
In the typical React dataflow, props are the only way that parent components interact with their children. To modify a child, you re-render...
Read more >Using the React.cloneElement() function to clone elements
This argument can be a React element or a component that renders a ... the props of a parent component's children while avoiding...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The workaround I’m using for now is to mutate a single object instead:
https://codepen.io/anon/pen/rXpGbj?editors=1010
I 100% guarantee there’s bugs in this btw.
Consider this scenario:
If we toggle
visible
once,detail
will be in$_attrs
evenvisible
is true. I think the root cause is vue v-dom diff policy.There are three ways to help this out:
v-show
instead ofv-if
key
to these two components