adopted-ember-addons / adopted-ember-addons/ember-data-model-fragments
Computed properties won't update on changes to nested model fragements
- Linguagem predominante
- TypeScript
- Estrelas
- 367
- Forks
- 108
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
I have the following models:
```javascript
// app/models/user.js
import Model from 'ember-data/model';
import {
fragment
} from 'model-fragments/attributes';
export default Model.extend({
family : fragment('family')
// other attrs
});
```
```javascript
// app/models/family.js
import Model from 'ember-data/model';
import {
fragment
} from 'model-fragments/attributes';
export default Model.extend({
spouse : fragment('personal'),
mother : fragment('personal'),
father : fragment('personal')
// other attrs
});
```
```javascript
// app/models/personal.js
import attr from 'ember-data/attr';
import Fragment from 'model-fragments/fragment';
export default Fragment.extend({
firstName : attr('string'),
lastName : attr('string'),
activeInsurance : attr() // This is not 'boolean' as it can be three-state: null, true & false
});
```
If I have an instance of the `user.family` model (let's say passed into a component), and I have a computed property which observes that model, cached result of the computed property won't be updated when the nested fragments data is changed:
```javascript
// This computed property won't react to changes on any family member
allFamilyHasInsurance: computed('myUser.family', function() {
//...
}),
```
Guia de contribuição
Direção de pesquisa
Start with the model definitions in app/models/user.js, app/models/family.js, and app/models/personal.js, then reproduce the computed property observing myUser.family. Trace how changes to nested fragment data propagate to the family model. Done means allFamilyHasInsurance recomputes when a family member's activeInsurance value changes.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- javascript
- Domínio
- frontend
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100