ngneat / forms-manager

🦄 The Foundation for Proper Form Management in Angular
https://www.netbasal.com
MIT License
518 stars 29 forks source link

Forms with update on blur, value not available immediately using getControl().value #17

Closed alexcotelin closed 3 years ago

alexcotelin commented 4 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

When using updateOn:'blur' on a form field, if I type something in the field and click submit button directly without tabbing out the input or clicking outside of it, the value using this.manager.getControl('stepOne','textarea').value is not available strait away, it needs a timeout.

Expected behavior

Should have the value available immediately.

Minimal reproduction of the problem with instructions

Please see the stackblitz example check the console logs when pressing submit. stackblitz edit example

What is the motivation / use case for changing the behavior?

Environment


Angular version: X.Y.Z


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

For Tooling issues:
- Node version: XX  
- Platform:  

Others:

alexcotelin commented 4 years ago

screen-recording

alexcotelin commented 4 years ago

Hi @NetanelBasal I'd like to fix this but can't find where the problem is exactly, can you point me to the right direction?

NetanelBasal commented 4 years ago

You need to debug, but I guess it's here: https://github.com/ngneat/forms-manager/blob/master/projects/ngneat/forms-manager/src/lib/forms-manager.ts#L380

alexcotelin commented 4 years ago

Thanks, I'll have a go