-
-
Notifications
You must be signed in to change notification settings - Fork 174
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
Debounced validation functionality #92
Conversation
|
||
assert.equal(object.get('validations.isValid'), false, 'isValid was expected to be FALSE'); | ||
// TODO: I feel like initially a debounced validation should not be debounced. | ||
assert.equal(object.get('validations.isValidating'), true, 'isValidating was expected to be TRUE'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right when we create the object, the lastName
debounced promised is created which sets the isValidating
to true
does anything cancel debounces, if the object is destroyed? |
Ah. No there is not cleanup. Let me do that 😄 |
@stefanpenner all done. Let me know if you approve 👯 |
@offirgolan ping me around noonish tomorrow, i gotta clear my queue of other stuff before i do a thorough review. |
Will do! |
let cache = getDebouncedValidationsCacheFor(model); | ||
// Return a promise and pass the resolve method to the debounce handler | ||
value = new Promise(resolve => { | ||
cache[attribute] = run.debounce(validator, getValidationResult, validator, options, model, attribute, resolve, debounce, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We likely need to deal with the > 1 debounced per attribute, and also > 1 debounced per attribute per type (2 ajax validators for 1 attribute example).
@stefanpenner seems like travis keeps failing because it cant find |
I decided to revert back to just using pojos as the caches. I really dont think there is much of a need to create another class for such a simple use case. In the future, if it becomes needed, ill make the refactor and hopefully by then es6 Map will be more widely supported (phantomjs included 😞 ). As for the |
Debounced validation functionality
In regards to #57 & #58
@stefanpenner @rwjblue let me know what you guys think of this.