The following error occurs in addon/index.js, line 21 when no items have yet been added to a has many relationship:
Uncaught TypeError: Cannot read property 'map' of undefined
if (relKind === "hasMany") {
data.relationships[key].data = snapshot.hasMany(relKey).map(this.serializeRecord);
}
I am unsure as to why an undefined, rather than empty, object is being returned when calling snapshot.hasMany(relKey) on an empty relationship, but I added a test for undefined and it worked in my example. I was unable, though, to replicate this issue in a test, and I am unsure if this is the right solution to the problem.
The following error occurs in addon/index.js, line 21 when no items have yet been added to a has many relationship:
I am unsure as to why an
undefined
, rather than empty, object is being returned when callingsnapshot.hasMany(relKey)
on an empty relationship, but I added a test forundefined
and it worked in my example. I was unable, though, to replicate this issue in a test, and I am unsure if this is the right solution to the problem.Let me know if you need more info.