lundi 5 octobre 2015

Handle null value in relationship model

I use ember with parse database, and use embe-parse-adapter

but i got this error after fetch the records

Error while processing route: index.index Cannot read property '_relationships' of null TypeError: Cannot read property '_relationships' of null

From various resource i read, I suspect its because there are null value in one of field that has relationship with other model,

How i can handle this?

The javascript stacktrace is:

Error while processing route: index.index Cannot read property '_relationships' of null TypeError: Cannot read property '_relationships' of null
    at ember$data$lib$system$relationships$state$relationship$$Relationship.addCanonicalRecord (http://ift.tt/1LuBH7R)
    at ember$data$lib$system$relationships$state$has$many$$ManyRelationship.addCanonicalRecord (http://ift.tt/1QVB9G2)
    at ember$data$lib$system$relationships$state$has$many$$ManyRelationship.computeChanges (http://ift.tt/1LuBH7T)
    at ember$data$lib$system$relationships$state$relationship$$Relationship.updateRecordsFromAdapter (http://ift.tt/1QVB9G4)
    at http://ift.tt/1LuBFwU
    at http://ift.tt/1QVBbOe
    at Map.forEach.cb (http://ift.tt/1LuBFwW)
    at OrderedSet.forEach (http://ift.tt/1QVBbOg)
    at Map.forEach (http://ift.tt/1LuBH7V)
    at Function.ember$data$lib$system$model$$default.reopenClass.eachRelationship (http://ift.tt/1QVBbOi)

and the versions i use:

DEBUG: -------------------------------
DEBUG: Ember             : 1.12.0
DEBUG: Ember Data        : 1.0.0-beta.18
DEBUG: jQuery            : 2.1.4
DEBUG: Ember Simple Auth : 0.8.0-beta.1
DEBUG: -------------------------------

Aucun commentaire:

Enregistrer un commentaire