BelongsToReference.meta()
sometimes not populated properly
#7039
Labels
BelongsToReference.meta()
sometimes not populated properly
#7039
Description
When an optional
belongsTo
relationship is loaded independently from the model it's defined on, e.g. when invokingawait someRecord.belongsTo('someRel').load()
, then the meta hash is only accessible onBelongsToReference
object whenAdapter.findBelongsTo()
resolves to a hash that contains a non-null value on itsdata
key.Say I have a record loaded through
store.findRecord('some-model', <some-id>)
, intially hydrated from the following JSONAPI document:Then let's say I load that one relationship with
await someRecord.belongsTo('someRel').load()
, If the request / response that resulted from that call look like:then
someRecord.belongsTo('someRel').meta()
will return{ foo: "bar" }
, which is correct. However if the request / response that resulted from that call look like:then
someRecord.belongsTo('someRel').meta()
will returnnull
, when I would have expected it to return{ foo: "bar" }
as well.Reproduction
models/car.ts
models/navigation-system.ts
adapters/car.ts
test.ts
Versions
The text was updated successfully, but these errors were encountered: