JSDATA try to fetch relations even when value of localKey is undefined
See original GitHub issueDescription
JSDATA try to fetch relations even when value of localKey is undefined
Steps to reproduce
-
Create relations inside record (for example article)
relations: { belongsTo: { author: { localField: 'author', localKey: 'author_id' } } }
-
Fetch article:
Article.find(id, { with: ['author'] })
-
Issue: even when returned
article.author_id
is not defined, JSData tries to fetch author
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How should i understand that data.key value is always ...
I try to google it but i do not know how to call it. let data = () => { let key =...
Read more >Switch to property accessors (getter/setter) for relations links.
+1 looks great ! As mentioned on gitter, no need to define the setter, best to leave it undefined so that if someone...
Read more >Relations - js-data
Starting with JS-Data 2.0, relations are linked to instances via property ... relations: { // hasMany uses "localField" and "localKeys" or "foreignKey" ...
Read more >Understanding the JavaScript Data Types - Tutorial Republic
Whereas Undefined and Null are special data types. Primitive data types can hold only one value at a time, whereas composite data types...
Read more >JavaScript maps vs. sets: Choosing your data structure
Each key/value pair contained in a Map object collection is usually ... Although the get() method returns undefined for nonexistent keys, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I prepared pull request: https://github.com/js-data/js-data-adapter/pull/13
@lusarz if you have some time can you add unit tests and be sure the coverage does decrease?