Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecordReference & BelongsToReference value() is inconsistent #5207

Closed
xomaczar opened this issue Oct 5, 2017 · 3 comments
Closed

RecordReference & BelongsToReference value() is inconsistent #5207

xomaczar opened this issue Oct 5, 2017 · 3 comments
Labels
🏷️ bug This PR primarily fixes a reported issue

Comments

@xomaczar
Copy link
Contributor

xomaczar commented Oct 5, 2017

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

@pangratz
Copy link
Member

pangratz commented Oct 6, 2017

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

let userRef = store.getReference('user', 1);
// check if the user is loaded
let isLoaded = userRef.value() !== null;

Wanna submit a bugfix PR?

@pangratz pangratz added the Bug label Oct 6, 2017
@xomaczar
Copy link
Contributor Author

xomaczar commented Oct 7, 2017

Sure - so null everywhere?

@pangratz
Copy link
Member

pangratz commented Oct 7, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bug This PR primarily fixes a reported issue
Projects
None yet
Development

No branches or pull requests

3 participants