Commit f90667e2 authored by Shane Eckenrode's avatar Shane Eckenrode

fix(responsive): Add explicit markForCheck call to force change detection when...

fix(responsive): Add explicit markForCheck call to force change detection when values are changed in order for host bindings to update
parent c498fdf5
Pipeline #111539 passed with stages
in 5 minutes and 6 seconds
import { Directive, HostBinding, OnDestroy, OnInit } from '@angular/core';
import { ChangeDetectorRef, Directive, HostBinding, OnDestroy, OnInit, SkipSelf } from '@angular/core';
import { Subject } from 'rxjs';
import { filter, takeUntil } from 'rxjs/operators';
import { ResponsiveService } from './responsive.service';
......@@ -19,7 +19,7 @@ export class ResponsiveDirective implements OnInit, OnDestroy {
private destroyed$ = new Subject<any>();
constructor(private responsiveService: ResponsiveService) {}
constructor(private responsiveService: ResponsiveService, @SkipSelf() protected cdRef: ChangeDetectorRef) {}
public ngOnInit(): void {
this.responsiveService.currentScreenSize$
......@@ -32,6 +32,7 @@ export class ResponsiveDirective implements OnInit, OnDestroy {
this.isSmallTablet = size === ScreenSize.TABLET_SM;
this.isTablet = size === ScreenSize.TABLET;
this.isDesktop = size === ScreenSize.DESKTOP;
this.cdRef.markForCheck();
});
}
......
  • SonarQube analysis indicates that quality gate is failed.

    • Bugs is failed: Actual value 1 > 0
    • high_severity_vulns is passed: Actual value 0
    • medium_severity_vulns is passed: Actual value 0

    SonarQube analysis reported 17 issues

    • 4 major
    • 🔽 7 minor
    • 6 info

    Top 10 extra issues

    Note: The following issues were found on lines that were not modified in the commit. Because these issues can't be reported as line comments, they are summarized here:

    1. Remove this useless assignment to variable "result". 📘
    2. Remove this useless assignment to variable "complete". 📘
    3. Remove this useless assignment to variable "loadResult". 📘
    4. Remove this useless assignment to variable "loadComplete". 📘
    5. 🔽 Add an "alt" attribute to this image. 📘
    6. 🔽 This assertion is unnecessary since it does not change the type of the expression. 📘
    7. 🔽 This assertion is unnecessary since it does not change the type of the expression. 📘
    8. 🔽 This assertion is unnecessary since it does not change the type of the expression. 📘
    9. 🔽 This assertion is unnecessary since it does not change the type of the expression. 📘
    10. 🔽 This assertion is unnecessary since it does not change the type of the expression. 📘
    • ... 7 more
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment