When fetching an editable hash via readEditableDataHash for a nested record, the nested hash is cloned causing it to get out of sync with its parent. The parent data hash should be cloned instead and a reference to the child hash returned.
This behavior is already present in the _lock method of SC.NestedStore. This pull request ports the code to the readEditableDataHash method of SC.Store so that editable hashes are created properly.
I noticed this when executing this sequence:
Edit a nested record via a NestedStore. This correctly clones records in to the NestedStore via the _lock method.
Commit changes to the parent by calling commitChanges on the NestedStore. This locks the records in the parent store.
Edit the nested record again (reusing the existing NestedStore). Since the records in the parent store are now locked (not editable), the cloning is done via readEditableDataHash in SC.Store instead of _lock. This clones the data incorrectly.
If I read the data hash for my nested store key, it will be different then if I read the data for my parent store key.
When fetching an editable hash via
readEditableDataHash
for a nested record, the nested hash is cloned causing it to get out of sync with its parent. The parent data hash should be cloned instead and a reference to the child hash returned.This behavior is already present in the
_lock
method ofSC.NestedStore
. This pull request ports the code to thereadEditableDataHash
method ofSC.Store
so that editable hashes are created properly.I noticed this when executing this sequence:
_lock
method.commitChanges
on the NestedStore. This locks the records in the parent store.readEditableDataHash
in SC.Store instead of_lock
. This clones the data incorrectly.