Skip to content
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

[Bug] Ember Data Model's errors field is not autotracked in 3.20 #19097

Closed
andreyfel opened this issue Aug 17, 2020 · 5 comments
Closed

[Bug] Ember Data Model's errors field is not autotracked in 3.20 #19097

andreyfel opened this issue Aug 17, 2020 · 5 comments

Comments

@andreyfel
Copy link
Contributor

andreyfel commented Aug 17, 2020

I'm updating Ember from 3.19 to 3.20 in my app and there is an issue which appeared after the update. I have a component which renders server errors for a certain field in the Ember Data model. In the component js it looks like this:

get errors() {
  const { model, field } = this.args;
  return model.errors.errorsFor(field).map(error => error.message);
}

Then I just render these messages in the template:

{{#each this.errors as |error|}}
  <li>{{error}}</li>
{{/each}}

If error comes after first render the component automatically re-rendered to show new errors.

It worked in Ember 3.19 but it doesn't work in Ember 3.20.

If I change it to computed by adding the following decorator it starts working in 3.20: @computed('args.model.errors.[]')

@andreyfel
Copy link
Contributor Author

Note that it is ember-source version that makes the difference. If I use ember-source@3.19 + ember-data@3.20 it works.

@andreyfel
Copy link
Contributor Author

andreyfel commented Aug 18, 2020

Here is the link to the reproduction repo: https://github.com/andreyfel/ember-data-errors-autotracking-bug
This app has a component and integration test.
Test fails for ember-source 3.20.4, but passes for 3.20.0, 3.20.1, 3.20.2, 3.20.3.

@andreyfel
Copy link
Contributor Author

I've tested the fix emberjs/data#7273 in my app and it fixed the issue with appearing of the new error. Unfortunately, removing the error is not working :(
I've updated my reproduction repo https://github.com/andreyfel/ember-data-errors-autotracking-bug to illustrate the issue.
@pzuraq do you have any idea?

@snewcomer
Copy link
Contributor

@andreyfel I believe this issue can be closed now with 3.20.4 (or recently release 3.22.0)

@andreyfel
Copy link
Contributor Author

@snewcomer Yes! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants