Skip to content

perf(lifecycle): Prevent rerender of child components that use $liste…#1

Open
Domino9697 wants to merge 1 commit into
devfrom
fix-listener-rerender
Open

perf(lifecycle): Prevent rerender of child components that use $liste…#1
Domino9697 wants to merge 1 commit into
devfrom
fix-listener-rerender

Conversation

@Domino9697

Copy link
Copy Markdown
Owner

Child components that use the $listeners attribute are rerendered each time the parent component is
updated. This is due to the updateChildComponent function that sets the reactive property
vm.$listeners thus triggering a rerender of the child component. The problem is that we cannot check
if the listeners were updated as we cannot compare functions. This change therefore provides a new
toggleNotifyingSubscribers method that disables a reactive property's ability to notify its
subscribers. We use this method to prevent the vm.$listeners property from rerendering the child
component.

fix vuejs#7257

…ners

Child components that use the $listeners attribute are rerendered each time the parent component is
updated. This is due to the updateChildComponent function that sets the reactive property
vm.$listeners thus triggering a rerender of the child component. The problem is that we cannot check
if the listeners were updated as we cannot compare functions. This change therefore provides a new
toggleNotifyingSubscribers method that disables a reactive property's ability to notify its
subscribers. We use this method to prevent the vm.$listeners property from rerendering the child
component.

fix vuejs#7257
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is Vue performing unnecessary re-render when using $listeners?

1 participant