Ext.data.Model#getData, using Ext.data.Model#prepareAssociatedData, will skip an associated record if it was previously serialized at any depth of the association tree.

Scenario:

Teacher has many Students

Teacher has many Books

Student has many Books

Calling Teacher#getData(true) will serialize Students and all of their Book records (maybe), then skip any of the Teacher's Book records that were previously serialized as a part of a Student. Reporting that the Teacher has fewer Book records than he really does results in some pretty nasty, somewhat invisible bugs - especially when dealing with more consequential data.


http://ift.tt/1qJ2GSv

Expected: Teacher has 3 books

Actual: Teacher has 1 book


A quick and dirty solution would be to skip over records in #prepareAssociatedData only if they're present in the id variable *AND* ~5 associations deep.