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

Expressions are called too many times #3799

Closed
awallat opened this issue Oct 27, 2023 · 3 comments
Closed

Expressions are called too many times #3799

awallat opened this issue Oct 27, 2023 · 3 comments
Labels

Comments

@awallat
Copy link

awallat commented Oct 27, 2023

Description
When using an expression-function to dynamically set the required-property for example, this function gets called a lot of times. I have got a big form and it suffers from performance issues, especially on slower machines.

In my simple example having just one field, the expression function gets called 4 times, when setting the model to a new value. Calling this.formState.resetModel(...) results in 11 calls.

Minimal Reproduction
https://stackblitz.com/edit/angular-mfw4c7?file=src%2Fapp%2Fapp.component.html

Your Environment

  • Angular version: 16.2.3
  • Formly version: 6.2.1
@awallat awallat added the bug label Oct 27, 2023
@aitboudad
Copy link
Member

We'll try to see if we can reduce the number of calls, please note if you're looking for a very optimized solution you may consider passing an Observable to expressions which will be called only when the Observable value is changed.

@aitboudad
Copy link
Member

This issue has been fixed and released as part of v6.2.2 release.

Please let us know, in case you are still encountering a similar issue/problem.
Thank you!

@aitboudad
Copy link
Member

I have got a big form and it suffers from performance issues, especially on slower machines.

To improve rendering time, use virtual scroll stackblitz.com/edit/angular-rfwvp6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants