Thanks to visit codestin.com
Credit goes to github.com

Skip to content

hasOne relations aren't found in store for newly added records #572

@zuzusik

Description

@zuzusik

Description

Environment

  • js-data version: latest
  • node or browser version: any
  • operating system: any

Steps to reproduce

try adding records to store which have hasOne relation and there are already related records in store - related records won't be linked to newly added records

Cause

The implementation of findExistingLinksFor is incorrect for hasOne relation:

findExistingLinksFor (relatedMapper, record) {

where it's being called like this:

relatedData = this.findExistingLinksFor(record)

so, as it's seen - first argument should be a record, and second argument even never passed

to compare, this is the impl of this method for hasMany:

findExistingLinksFor (record) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions