From f76bf70c4817faea25deb83a26852ca17ec2e813 Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Tue, 3 Sep 2024 10:44:49 +0300 Subject: [PATCH] refactor(core): add `tuiZonefreeScheduler` for `TuiScrollControls` (#8742) --- .../components/scrollbar/scroll-controls.component.ts | 4 ++-- projects/core/components/scrollbar/scrollbar.directive.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/projects/core/components/scrollbar/scroll-controls.component.ts b/projects/core/components/scrollbar/scroll-controls.component.ts index 83e1456fc1ff..9bb85d65c17b 100644 --- a/projects/core/components/scrollbar/scroll-controls.component.ts +++ b/projects/core/components/scrollbar/scroll-controls.component.ts @@ -1,7 +1,7 @@ import {AsyncPipe, NgIf} from '@angular/common'; import {ChangeDetectionStrategy, Component, inject} from '@angular/core'; import {WA_ANIMATION_FRAME} from '@ng-web-apis/common'; -import {tuiZoneOptimized} from '@taiga-ui/cdk/observables'; +import {tuiZonefreeScheduler, tuiZoneOptimized} from '@taiga-ui/cdk/observables'; import {tuiFadeIn} from '@taiga-ui/core/animations'; import {TUI_ANIMATIONS_SPEED, TUI_SCROLL_REF} from '@taiga-ui/core/tokens'; import {tuiToAnimationOptions} from '@taiga-ui/core/utils'; @@ -23,7 +23,7 @@ export class TuiScrollControls { protected readonly options = tuiToAnimationOptions(inject(TUI_ANIMATIONS_SPEED)); protected readonly refresh$ = inject(WA_ANIMATION_FRAME).pipe( - throttleTime(300), + throttleTime(300, tuiZonefreeScheduler()), map(() => this.scrollbars), startWith([false, false]), distinctUntilChanged((a, b) => a[0] === b[0] && a[1] === b[1]), diff --git a/projects/core/components/scrollbar/scrollbar.directive.ts b/projects/core/components/scrollbar/scrollbar.directive.ts index aaf16c26ba16..91db2c8c45ba 100644 --- a/projects/core/components/scrollbar/scrollbar.directive.ts +++ b/projects/core/components/scrollbar/scrollbar.directive.ts @@ -1,7 +1,11 @@ import {Directive, inject, Input} from '@angular/core'; import {takeUntilDestroyed} from '@angular/core/rxjs-interop'; import {WA_ANIMATION_FRAME} from '@ng-web-apis/common'; -import {tuiScrollFrom, tuiZonefree} from '@taiga-ui/cdk/observables'; +import { + tuiScrollFrom, + tuiZonefree, + tuiZonefreeScheduler, +} from '@taiga-ui/cdk/observables'; import {tuiInjectElement} from '@taiga-ui/cdk/utils/dom'; import {TUI_SCROLL_REF} from '@taiga-ui/core/tokens'; import {merge, throttleTime} from 'rxjs'; @@ -37,7 +41,7 @@ export class TuiScrollbarDirective { }); protected readonly styleSub = merge( - inject(WA_ANIMATION_FRAME).pipe(throttleTime(100)), + inject(WA_ANIMATION_FRAME).pipe(throttleTime(100, tuiZonefreeScheduler())), tuiScrollFrom(this.el), ) .pipe(tuiZonefree(), takeUntilDestroyed())