fix(module:icon): debounce icon rendering on animation frame - #8579
Conversation
|
This preview will be available after the AzureCI is passed. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8579 +/- ##
==========================================
- Coverage 92.06% 92.06% -0.01%
==========================================
Files 560 560
Lines 19621 19625 +4
Branches 3098 3099 +1
==========================================
+ Hits 18064 18067 +3
Misses 1218 1218
- Partials 339 340 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR debounces icon rendering on animation frames to improve performance when many icons are rendered, integrates PendingTasks for SSR hydration, and centralizes zone handling.
- Debounce icon rendering with
animationFrameScheduleron browser andasapScheduleron server. - Inject and use
PendingTasksto register hydration tasks and finalize them correctly. - Move zone boundaries: invoke
changeIcon2outside Angular inngOnChanges.
Comments suppressed due to low confidence (4)
components/icon/icon.directive.ts:133
- There are no tests covering the new debounce behavior in browser vs. server environments. Please add unit tests to verify debouncing works as intended and tasks are finalized correctly.
debounceTime(0, this.isBrowser ? animationFrameScheduler : asapScheduler),
components/icon/icon.directive.ts:127
- [nitpick] The name
removeTaskis vague. Consider renaming to something likeremovePendingTaskto clarify that this callback unregisters a pending hydration task.
const removeTask = this.pendingTasks.add();
components/icon/icon.directive.ts:139
- [nitpick] The parameter
svgOrRemoveis ambiguous. Rename it tosvgElementorrenderedSvgfor clarity on what the callback receives.
next: svgOrRemove => {
components/icon/icon.directive.ts:122
- The method
changeIcon2assumes it runs outside Angular but onlyngOnChangeswraps it inrunOutsideAngular. IfchangeIcon2is called elsewhere, it might trigger unwanted change detection. Consider movingrunOutsideAngularinsidechangeIcon2for consistency.
private changeIcon2(): void {
|
@arturovt please rebase to resolve conflicts |
Closes #7825