Open maxymczech opened 3 years ago
@maxymczech Your link got double-pasted in the OP here: https://github.com/maxymczech/ember-data-crash-test
@jfdnc, sorry my bad, fixed, thank you.
What's the error thrown?
Error while processing route: index Cannot read properties of null (reading 'type') TypeError: Cannot read properties of null (reading 'type')
at Store._pushInternalModel (http://localhost:4200/assets/vendor.js:89852:28)
at http://localhost:4200/assets/vendor.js:89833:38
at Backburner._run (http://localhost:4200/assets/vendor.js:57697:25)
at Backburner._join (http://localhost:4200/assets/vendor.js:57673:21)
at Backburner.join (http://localhost:4200/assets/vendor.js:57444:19)
at Store._push (http://localhost:4200/assets/vendor.js:89818:52)
at http://localhost:4200/assets/vendor.js:87303:34
at invokeCallback (http://localhost:4200/assets/vendor.js:64509:17)
at publish (http://localhost:4200/assets/vendor.js:64492:9)
at http://localhost:4200/assets/vendor.js:58819:53
@maxymczech that's not an unknown model type, it seems you literally tried to supply null
to the store as the data. I'd check that your serializer output is correct.
Edit: I see better now, the JSON:API serializer is returning an invalid response for those records.
Reproduction
Github repository with reproduction: https://github.com/maxymczech/ember-data-crash-test
Description
Whenever we add new model type to the API, the older versions of the app start crashing upon encountering new model types. For now, I was able to solve this issue by adding the following code to application serializer:
Versions