Opened 10 years ago
Closed 10 years ago
#12761 closed enhancement (fixed)
ItemFileReadStore: don't modify original data objects
Reported by: | bht | Owned by: | Jared Jurkiewicz |
---|---|---|---|
Priority: | high | Milestone: | 1.6 |
Component: | Data | Version: | 1.6.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description (last modified by )
http://docs.dojocampus.org/dojo/data/ItemFileReadStore
For data, the documentation contains a disclaimer:
"The data object passed in is directly used and modified. If you want to reuse a data object, make sure you copy it before you pass it in."
However, with the effort required to use the implementation, one expects to deal with a MVC architecture that leaves the business objects alone, as other frameworks do.
With that I mean that the implementation expects a Model, with implementation specific requirements, which contains in it the Model Object.
It appears that dojo converts attributes of the model objects into arrays containing the attributes at index 0.
I think that the whole scenario is actually quite rude, to apply such bad practice and then add a disclaimer to the docs like, deal with it, we told you so.
So this issue is about changing the ItemFileReadStore in such a way that it does not mess around with the model objects. If it really needs its own data to play with then it should create it.
Change History (3)
comment:1 Changed 10 years ago by
Milestone: | tbd → future |
---|---|
Priority: | high → normal |
Resolution: | → wontfix |
Status: | new → closed |
Type: | defect → enhancement |
comment:2 Changed 10 years ago by
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
comment:3 Changed 10 years ago by
Description: | modified (diff) |
---|---|
Milestone: | future → 1.6 |
Resolution: | → fixed |
Status: | reopened → closed |
Summary: | ItemFileReadStore is not read-only → ItemFileReadStore: don't modify original data objects |
Surely we won't change ItemFileReadStore as it's essentially deprecated in favor of dojo.store.Memory. The good news is that that dojo.store.Memory doesn't add any attributes to the original objects. Confirmed by running util/doh/runner.html?testModule=dojo.tests.store.Memory and setting a breakpoint around the first store.get() call.
I'm going to mark this as fixed in 1.6, through the new dojo.store.Memory API.
The store clearly states its expectations and what behaviors it has. It isn't a disclaimer, it's a clear statement on what it does. Therefore this cannot be classified as a bug and has been adjusted to enhancement state to alter current behavior.