Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rc.5 [ngClass] is re-rendering on scroll #34336

Closed
rokerkony opened this issue Dec 10, 2019 · 5 comments
Closed

rc.5 [ngClass] is re-rendering on scroll #34336

rokerkony opened this issue Dec 10, 2019 · 5 comments
Assignees
Labels
area: core Issues related to the framework runtime area: performance type: bug/fix
Milestone

Comments

@rokerkony
Copy link

🐞 bug report

Affected Package

Probably related to Ivy?

Is this a regression?

it was not re-rendering in ng8

Description

By using [ngClass] on angular 9...rc.5 the class value is re-rendering all over again when using HostListener and window scroll event.

By using I mean:

  @HostListener('window:scroll', ['$event'])
  public updateVisibility (): void {
    // nothing related to the class, in my demo even empty
  }

It probably kills performance due to the constant changing of the DOM but also we have a component working with images and this behavior makes them reload all over again.

🔬 Minimal Reproduction

I created a video(as gif) to show this error:
720p

also created a gist with 3 files to reproduce it:
https://gist.github.com/rokerkony/dbd4e5f4f5307e38f7e1350755693fca

🌍 Your Environment

Angular Version:


Angular CLI: 9.0.0-rc.5
Node: 12.12.0
OS: darwin x64

Angular: 9.0.0-rc.5
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-rc.5
@angular-devkit/build-angular     0.900.0-rc.5
@angular-devkit/build-optimizer   0.900.0-rc.5
@angular-devkit/build-webpack     0.900.0-rc.5
@angular-devkit/core              9.0.0-rc.5
@angular-devkit/schematics        9.0.0-rc.5
@ngtools/webpack                  9.0.0-rc.5
@schematics/angular               9.0.0-rc.5
@schematics/update                0.900.0-rc.5
rxjs                              6.5.3
typescript                        3.6.4
webpack                           4.41.2
@pkozlowski-opensource
Copy link
Member

Thnx for reporting @rokerkony ! We we've found it independently during the internal testing / benchmarking and working on a fix. I will keep this one open to make sure that the WIP fix takes care of this one. Again, thnx for taking time to report and share a reproduce scenario!

@ngbot ngbot bot added this to the needsTriage milestone Dec 10, 2019
@pkozlowski-opensource pkozlowski-opensource added the area: core Issues related to the framework runtime label Dec 10, 2019
@kara kara modified the milestones: v9-candidates, v9-blockers Dec 10, 2019
@neofuture
Copy link

I am seeing a similar issue but without the need to scroll as its a static spa that is full screen i can see elements jittering in the console constantly.

video below

https://www.youtube.com/watch?v=M8-YHmuasm8

@rodolfojnn
Copy link

Same here on Ivy. NgClass constantly repaint the class attribute.

@tonivj5
Copy link

tonivj5 commented Dec 17, 2019

Maybe #34307 fixes this?

IgorMinar pushed a commit to matsko/angular that referenced this issue Jan 14, 2020
…changes

Prior to this change, in Ivy mode ngStyle/ngClass would accidentally emit value changes for static
(string-based) values even if the value itself had not changed. This patch ensures that
the style/class diffing code is more strict and when it signals ngClass/ngStyle that there has been
a value change.

Fixes angular#34336, angular#34444
IgorMinar pushed a commit to matsko/angular that referenced this issue Jan 14, 2020
…changes

Prior to this change, in Ivy mode ngStyle/ngClass would accidentally emit value changes for static
(string-based) values even if the value itself had not changed. This patch ensures that
the style/class diffing code is more strict and when it signals ngClass/ngStyle that there has been
a value change.

Fixes angular#34336, angular#34444
IgorMinar pushed a commit to matsko/angular that referenced this issue Jan 14, 2020
…changes

Prior to this change, in Ivy mode ngStyle/ngClass would accidentally emit value changes for static
(string-based) values even if the value itself had not changed. This patch ensures that
the style/class diffing code is more strict and when it signals ngClass/ngStyle that there has been
a value change.

Fixes angular#34336, angular#34444
IgorMinar pushed a commit to matsko/angular that referenced this issue Jan 15, 2020
…changes

Prior to this change, in Ivy mode ngStyle/ngClass would accidentally emit value changes for static
(string-based) values even if the value itself had not changed. This patch ensures that
the style/class diffing code is more strict and when it signals ngClass/ngStyle that there has been
a value change.

Fixes angular#34336, angular#34444
matsko added a commit that referenced this issue Jan 17, 2020
…changes (#34307)

Prior to this change, in Ivy mode ngStyle/ngClass would accidentally emit value changes for static
(string-based) values even if the value itself had not changed. This patch ensures that
the style/class diffing code is more strict and when it signals ngClass/ngStyle that there has been
a value change.

Fixes #34336, #34444

PR Close #34307
@matsko matsko closed this as completed in abd4628 Jan 17, 2020
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime area: performance type: bug/fix
Projects
None yet
Development

No branches or pull requests

7 participants