I’m encountering an issue with Ember Data (version 5.3.0) involving relationships not resolving as expected. My setup:
- TPE model has a
belongsTorelationship with thenetwork-construct(NC) model:
js
networkConstruct: belongsTo('network-construct', {
async: false,
inverse: null
}),
- The NC data is fetched and preloaded before TPE is loaded (the NC API is called first), then much later, the TPE API call is made. I expect that:
js
get(tpe, 'networkConstruct.id')
should return the network construct’s ID.
- The TPE API response includes:
json
"networkConstruct": {
"data": {
"type": "networkConstructs",
"id": "1b4543e5-d142-33f8-8385-3c6b9285ae9c"
}
}
- I have two backend systems: one with Cassandra and one with Postgres. Both produce identical JSON API responses.
Problem:
When using the Postgres backend, the relationship is not resolved and ncID is always null, even though it works fine with Cassandra. There are no apparent differences in the JSON.
Additional context:
- Ember Data version: 5.3.0
- Both models are defined as described above.
ncIDisnullwhen accessed.
Questions:
- Has anyone encountered a similar issue with relationships not resolving (especially with multiple backends)?
- Are there any additional diagnostics or common gotchas for relationship resolution with Ember Data 5.x I should check?
- Suggestions, debugging strategies, or pointers to relevant documentation would be much appreciated!
2 posts - 2 participants