fix(hasOne): do not create links for undefined or null keys by nickescallon · Pull Request #379 · js-data/js-data
Navigation Menu
{{ message }}
- Notifications You must be signed in to change notification settings
- Fork 137
Merged
jmdobry merged 1 commit intojs-data:masterfrom
Aug 3, 2016Merged
fix(hasOne): do not create links for undefined or null keys#379
jmdobry merged 1 commit intojs-data:masterfrom
fix(hasOne): do not create links for undefined or null keys#379
jmdobry merged 1 commit intojs-data:masterfrom
Conversation
Copy link Copy Markdown
Contributor
hasOne links were being created in cases they should not.
- when no link existed, foreignKey was
undefined - we tried to filter on
relatedCollectionwhere theforeignKey === undefined - this returned the entire set of records that did not actually have any related records, where in fact we don't want to find any relations in this case.
nickescallon
force-pushed
the
fix-hasOne
branch
from
fc95463 to
ff87b83
Compare
| findExistingLinksByForeignKey (id) { | ||
| if (id === undefined || id === null) { | ||
| return | ||
| } |
Copy link Copy Markdown
Contributor Author
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or we could rework this method such that it returns an empty array in this case.
Copy link Copy Markdown
Pargus
commented
Aug 2, 2016
Pargus commented
Aug 2, 2016Issue with Plunkers showing the bug: #380
jmdobry
merged commit
fd97bf9
into
js-data:master
jmdobry
modified the milestone:
3.0.0 Release Candidate
jmdobry
mentioned this pull request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment