You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When awaiting an observer's validate method, the function returns before the observer's state (flags and errors) are available, due to the debounce delay in the computeObserverState watcher. This is causing my e2e tests to fail. In my case, my code checks both the validation result and then another computed prop which depends on the form having been validated.
e.g. if (!(await this.$refs.observer.validate() && this.$refs.observer.flags.validated))...
I have confirmed that setting the debounce delay to 0 in Observer.ts fixes the issue.
Expected behavior
I would have expected the validation flags to be available as soon as the validate promise resolves.
Desktop (please complete the following information):
OS: Linux
Browser Cypress / Electron (Chromium 78)
Version 3.8.3
This is the same issue described in #2660, but with a different desired outcome. I don't think the validate response itself should change, I just don't want it to return until it's actually complete.
In my debugging, I found I can resort to a really hacky workaround like this:
Sometimes it passes with a delay as low as 30, but occasionally it needs more so I had to leave it at 50. No idea why I can't go down closer to 16.
I really didn't like that workaround, though, so instead I'm just tracking the validated state separately in my component. I just wish I could rely on the flags provided by the library. Perhaps the debounce function could return a promise that is included in the validate's Promise.all or something.
The text was updated successfully, but these errors were encountered:
This came up a few times so far, I guess having the validate method account for the delay would be a more suitable. I will see what I can do this weekend.
Versions
Describe the bug
When awaiting an observer's
validate
method, the function returns before the observer's state (flags and errors) are available, due to the debounce delay in the computeObserverState watcher. This is causing my e2e tests to fail. In my case, my code checks both the validation result and then another computed prop which depends on the form having been validated.e.g.
if (!(await this.$refs.observer.validate() && this.$refs.observer.flags.validated))...
I have confirmed that setting the debounce delay to 0 in Observer.ts fixes the issue.
Expected behavior
I would have expected the validation flags to be available as soon as the validate promise resolves.
Desktop (please complete the following information):
This is the same issue described in #2660, but with a different desired outcome. I don't think the validate response itself should change, I just don't want it to return until it's actually complete.
In my debugging, I found I can resort to a really hacky workaround like this:
Sometimes it passes with a delay as low as 30, but occasionally it needs more so I had to leave it at 50. No idea why I can't go down closer to 16.
I really didn't like that workaround, though, so instead I'm just tracking the validated state separately in my component. I just wish I could rely on the flags provided by the library. Perhaps the debounce function could return a promise that is included in the validate's Promise.all or something.
The text was updated successfully, but these errors were encountered: