Browse Source

UI: Apply angular zone on resize observer callback when necessary.

pull/11725/head
Igor Kulikov 2 years ago
parent
commit
5101d67f0d
  1. 12
      ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts

12
ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.ts

@ -211,11 +211,13 @@ export class AttributeTableComponent extends PageComponent implements AfterViewI
ngOnInit() { ngOnInit() {
this.widgetResize$ = new ResizeObserver(() => { this.widgetResize$ = new ResizeObserver(() => {
const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue; this.zone.run(() => {
if (showHidePageSize !== this.hidePageSize) { const showHidePageSize = this.elementRef.nativeElement.offsetWidth < hidePageSizePixelValue;
this.hidePageSize = showHidePageSize; if (showHidePageSize !== this.hidePageSize) {
this.cd.markForCheck(); this.hidePageSize = showHidePageSize;
} this.cd.markForCheck();
}
});
}); });
this.widgetResize$.observe(this.elementRef.nativeElement); this.widgetResize$.observe(this.elementRef.nativeElement);
} }

Loading…
Cancel
Save