From 34e81be9abcadcbd28eee4181732485c4010766c Mon Sep 17 00:00:00 2001 From: Nikita Barsukov Date: Tue, 26 Mar 2024 11:40:06 +0300 Subject: [PATCH] chore(demo): documentation page `Tooltip` has infinite SSR --- .../components/tooltip/examples/1/index.html | 5 ++-- .../components/tooltip/examples/1/index.ts | 25 ++++++------------- .../components/tooltip/tooltip.module.ts | 2 ++ 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/projects/demo/src/modules/components/tooltip/examples/1/index.html b/projects/demo/src/modules/components/tooltip/examples/1/index.html index 1c5b8c1459753..62da3c7bb718a 100644 --- a/projects/demo/src/modules/components/tooltip/examples/1/index.html +++ b/projects/demo/src/modules/components/tooltip/examples/1/index.html @@ -22,11 +22,12 @@ - {{ text }} + {{ this.isLoading ? '' : 'Error 502: Bad Gateway' }} diff --git a/projects/demo/src/modules/components/tooltip/examples/1/index.ts b/projects/demo/src/modules/components/tooltip/examples/1/index.ts index ffc348574b241..061e62d290a5d 100644 --- a/projects/demo/src/modules/components/tooltip/examples/1/index.ts +++ b/projects/demo/src/modules/components/tooltip/examples/1/index.ts @@ -1,8 +1,8 @@ -import {ChangeDetectorRef, Component, inject} from '@angular/core'; +import {Component} from '@angular/core'; import {changeDetection} from '@demo/emulate/change-detection'; import {encapsulation} from '@demo/emulate/encapsulation'; -import {TuiDestroyService, tuiWatch} from '@taiga-ui/cdk'; -import {interval, takeUntil} from 'rxjs'; +import {TuiDestroyService} from '@taiga-ui/cdk'; +import {interval, map, startWith} from 'rxjs'; @Component({ selector: 'tui-tooltip-example-1', @@ -13,19 +13,8 @@ import {interval, takeUntil} from 'rxjs'; providers: [TuiDestroyService], }) export class TuiTooltipExample1 { - protected loader = true; - - protected text = ''; - - constructor() { - interval(2000) - .pipe( - tuiWatch(inject(ChangeDetectorRef)), - takeUntil(inject(TuiDestroyService, {self: true})), - ) - .subscribe(() => { - this.loader = !this.loader; - this.text = this.text ? '' : 'Error 502: Bad Gateway'; - }); - } + protected isLoading$ = interval(2000).pipe( + map(i => Boolean(i % 2)), + startWith(true), + ); } diff --git a/projects/demo/src/modules/components/tooltip/tooltip.module.ts b/projects/demo/src/modules/components/tooltip/tooltip.module.ts index 6a46795d99820..2bee909f2aec4 100644 --- a/projects/demo/src/modules/components/tooltip/tooltip.module.ts +++ b/projects/demo/src/modules/components/tooltip/tooltip.module.ts @@ -3,6 +3,7 @@ import {NgModule} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; import {TuiAddonDocModule, tuiGenerateRoutes} from '@taiga-ui/addon-doc'; +import {TuiLetModule} from '@taiga-ui/cdk'; import { TuiAutoColorPipe, TuiHintModule, @@ -37,6 +38,7 @@ import {ExampleTuiTooltipComponent} from './tooltip.component'; TuiTextfieldControllerModule, RouterModule.forChild(tuiGenerateRoutes(ExampleTuiTooltipComponent)), TuiAutoColorPipe, + TuiLetModule, ], declarations: [ ExampleTuiTooltipComponent,