Multiple use of on('init') might cause inconsistencies#421
Multiple use of on('init') might cause inconsistencies#421yonjah wants to merge 1 commit intoDavyJonesLocker:masterfrom
Conversation
|
@yonjah Can you rebase on master, now that we have fixed the test suite? |
|
|
|
@bcardarella I'm sure there was a good reason to use @martndemus I'll try to pull in the changes from master and rebase |
|
How are you guys with breaking changes to the API ? There are two ways around it -
I personally prefer the first way but it is not how the API is currently designed. Also there is a test that actually check if |
|
Technically the library is still in alpha, so if it is a valid change we can do it |
|
I reverted most of the changes only aggregating everything into a single |
I don't have a concrete issue, but I was looking for some other stuff and noticed this code -
https://github.com/DockYard/ember-validations/blob/master/addon/validators/base.js#L16
The base object is calling multiple functions using
on init.Some of this functions are relying on other function on the
on initprocess to finish (likepushConditionalDependentValidationKeysthat has to run beforeaddObserversForDependentValidationKeys).But since the execution order of
on initis not guaranteed this create a very fragile code.I made this pull request to fix this issue.
I couldn't get the automatic test to work so a more careful examination of this fix might be necessary .
P.S - On another look I think the
pushDependentValidationKeyToModelis not really doing any thing so I removed it. It treated model.dependentValidationKeys as an object even it was an array, and it tries to addthis propertyto it even though it was add in the maininitfunction