Data: RecordReference & BelongsToReference value() is inconsistent

Created on 5 Oct 2017  路  3Comments  路  Source: emberjs/data

If the record does not exist in the store, we get the following:

let recordReference = this.store.getReference('book', '1');
recordReference.value() === undefined

while belongsToReference

let author = this.store.peekRecord('author', 1);
author.belongsTo('book').value() === null

The docs treat these too cases the same

Bug

Most helpful comment

Sure - so null everywhere?

All 3 comments

Good catch! This seems like a bug since the documentation mentions it should return null:

https://github.com/emberjs/data/blob/5fceead8acb53723bdf38daabad00aff093f390a/addon/-private/system/store.js#L981-L984

Wanna submit a bugfix PR?

Sure - so null everywhere?

Yes. Have you found other undefined values for value()?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jherdman picture jherdman  路  4Comments

concertiv picture concertiv  路  4Comments

HenryVonfire picture HenryVonfire  路  3Comments

NullVoxPopuli picture NullVoxPopuli  路  5Comments

graham-sportsmgmt picture graham-sportsmgmt  路  3Comments