#Change detection with OnPush on FormControl
11 messages Β· Page 1 of 1 (latest)
well but that is kinda what i want to achieve. I want the control over the form handling via observing valueChange & statusChange
Is there any way i could "opt out" from this behavior or something?
What's the point of doing manually what's going on naturally?
Whats the point of update the view when you know nothing has changed that would be needed to display?
I have nothing against something that goes automatically but if it causes the entire view to be checked again when its not necessary, i'd like to don't do it π€·ββοΈ
Not the entire view, only the bad boys not using OnPush.
About knowing if stuff changed, it means you are asserting the form validity on each change, adding computation task.
In 2022 such a computation task or change detection on an isolated form won't affect the user experience
And to act only when necessary means you need a local state to store the previous computation result: if the form is valid, you need to know if it was valid or invalid on previous valueChanges/statusChanges
True. It most likely won't have significant impact on performance unless your using Default detection & binding functions in your views etc. (but then you have bigger issues to work on anyways π
)
I just got curios why i got so many logs emitted when checking how many times the event got triggered & that led to that question π
In case your wondering. In my particular scenario its just a simple input field that acts as a filter so i don't really care about the validity since any input is valid in there.
Really appreciate the discussion π
The control you can have over your form is through the updateOn option but only change|submit|blur options are availables
Jep, I guess if i would really want my filter input not to render the view i'd just have to listen manually to the input event with runOutsideAngular.
But as you already said your self. It doesn't really affect the performance anyways.
Thanks for the explanation π