adopted-ember-addons / adopted-ember-addons/ember-data-model-fragments
"Cannot read property 'didChange' of undefined" when upgrading from 1.13.1 to 1.13.2
- Lenguaje dominante
- TypeScript
- Estrellas
- 367
- Forks
- 108
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
After updating from 1.13.1 to 1.13.2 (that changed setProperties to internalModel#setupData) we've started getting `Cannot read property 'didChange' of undefined` when saving a record that has nested fragments.
**Trace**:
```
TypeError: Cannot read property 'didChange' of undefined
at chainsDidChange (ember.debug.js:20537)
at propertyDidChange (ember.debug.js:20417)
at iterDeps (ember.debug.js:20504)
at dependentKeysDidChange (ember.debug.js:20460)
at Object.propertyDidChange (ember.debug.js:20414)
at exports.default._emberMetalMixin.Mixin.create.propertyDidChange (ember.debug.js:36766)
at exports.default._emberMetalMixin.Mixin.create.notifyPropertyChange (ember.debug.js:36780)
at Ember.Object.extend._notifyProperties (model.js:564)
at InternalModel.ember$data$lib$system$model$internal$model$$InternalModel.setupData (internal-model.js:196)
at model$fragments$lib$fragments$fragment$$setFragmentData (fragment.js:191)
```
**Setup**:
``` js
// Setup is something like this:
// model.js
export default DS.Model.extend({
sections: MF.fragmentArray('section')
)};
// section.js
export default MF.Fragment.extend({
subSections: MF.fragmentArray('sub-section')
});
// sub-section.js
export default MF.Fragment.extend({
...
});
```
**Steps to reproduce**:
- load a model with nested fragments into the store
- save the model
- TypeError
**note**: this only seems to happen if:
- the nested fragment (`sub-section`) is present
- **the nested fragment was not changed** (if it's dirty the error is not triggered)
ember: 1.13.10
ember data: 1.13.15
I'll try to find a way to reproduce this outside of our app or write a failing test when I have some more time.
Guía de contribución
Línea de trabajo
Start at fragment.js:191 and internal-model.js:196, then inspect model.js:564 along the traced save path. Reproduce with nested fragments where the sub-section is unchanged, and add the failing test the report calls for. Done means saving that setup no longer raises the TypeError and the regression is covered.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, typescript
- Área
- backend
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 30/100