CirclonGroup / angular-tree-component

A simple yet powerful tree component for Angular (>=2)
https://angular2-tree.readme.io/docs
MIT License
1.1k stars 492 forks source link

perf: do not run change detection if there is no `mouseAction` defined #936

Closed arturovt closed 2 years ago

arturovt commented 2 years ago

The <div class="node-content-wrapper"></div> adds event listeners within the Angular zone. This is one of the most widely used components. The interaction with this component causes Angular to run change detection and usually leads to frame drops when multiple ApplicationRef.tick() are run within the same rendering frame.

This commit adds event listeners for the <div class="node-content-wrapper"></div> outside of the Angular zone; thus they don't trigger change detection until there's mouseAction is defined. There's no other way to add event listeners outside of the Angular zone except adding them manually.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

[x] Refactoring (no functional changes, no api changes)

Does this PR introduce a breaking change?

[ ] Yes
[x] No