question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSDATA try to fetch relations even when value of localKey is undefined

See original GitHub issue

Description

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:open
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lusarzcommented, Jun 24, 2018
0reactions
crobinson42commented, Jun 26, 2018

@lusarz if you have some time can you add unit tests and be sure the coverage does decrease?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found