data
data copied to clipboard
[BUGFIX] uncommitted model should be able to 'becameValid'
Hey guys,
I faced a problem and did a test + added a fix, the simplest way to replicate:
myModel = this.store.createRecord('my-model');
myModel.errors.add('fieldA', ['blank']);
myModel.errors.add('fieldB', ['blank']);
later(() => {
set(myModel, 'fieldA', 'value');
set(myModel, 'fieldB', 'value');
}, 1000);
It raises an error:
Attempted to handle event `becameValid` on <my-model:null> while in state root.loaded.created.uncommitted.
I'm not sure why it is being raised only if there are 2 or more fields with errors.
once the defunct state-machine is dropped this would be a non-issue. Probably the more interesting test to add is what happens to the user-observable state during this transition. You might also want to try completing the work in #7971
I'm experiencing this issue going from 3.24 to 3.28. @runspired Would it be possible for this to be released as a patch in 3.28?
I think it should be added as a fix for both v3.28 and v4. Even if this code will be dropped completely, at least it will allow users to upgrade. Also, it's a regression.
@yratanov I don't think it's a regression, it's simply a state that has never been handled by ember-data. More than likely it should have been handled a long time ago, but never got implemented. If folks are encountering this upgrading from 3.24->3.28 that is especially surprising. It suggests that pre-request-manager activation failed creates were ignored in terms of internal state and would not have added validation errors to individual attributes, which itself would be a bug.
closed in favour of #8154