Opened 10 years ago
Closed 9 years ago
#11890 closed defect (fixed)
Bug updating ClientFilter's cache after a JsonRestStore newItem
Reported by: | zladivliba | Owned by: | Kris Zyp |
---|---|---|---|
Priority: | blocker | Milestone: | 1.8 |
Component: | DojoX Data | Version: | 1.5 |
Keywords: | dohfail jsonreststore clientfilter kriszip | Cc: | |
Blocked By: | Blocking: |
Description
i'm using clientFilter to cache a JsonRestStore? :
this.Stores[0] = new dojox.data.JsonRestStore?({target:"/os/", idAttribute:"id"}); this.Stores[0].cacheByDefault = true;
then I'm sending this.Stores[0] to the widget I'm working with.
Upon creation of a new element, the store doesn't update :
this.Store.fetch({onComplete : dojo.hitch(this, function(items,request){ console.log("this store fetch", items, items.length); This returns 1 item var newClient = this.Store.newItem(data); console.log(newClient); this.Store.updateResultSet(items, request); New request after updateResultSet this.Store.fetch({onComplete : function(items,request){ console.log("this store fetch after updateResultSet", items, items.length);
This returns 1 item. And the internal cache has not been updated
}});
})});
Change History (6)
comment:1 Changed 10 years ago by
Owner: | changed from Jared Jurkiewicz to Kris Zyp |
---|
comment:2 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 Changed 9 years ago by
The ClientFilter? expects a query to be an object in order for the query to be cacheable. I updated the code to allow the special case of a non-existent query (should be treated the same as an query for everything, an empty object {}).
comment:4 Changed 9 years ago by
Milestone: | tbd → 1.8 |
---|
comment:5 Changed 9 years ago by
Keywords: | dohfail added |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
[27485] breaks the regression test, at least on FF/mac:
5 tests to run in 1 groups ------------------------------------------------------------ GROUP "dojox.data.tests.ClientFilter" has 5 tests to run Error: test timeout in updateWhileLoading ERROR IN: (function updateWhileLoading(t) {var d = new doh.Deferred;jsonStore.fetch({query: {lastName: "Smith", firstName: "*"}, sort: [{attribute: "firstName", descending: true}], onComplete: function (items, request) {t.is(5, items.length);t.is(newJack, items[4]);console.log("updateWhileLoading", items[4], newJack);d.callback(true);}});newJack = jsonStore.newItem({firstName: "Jack", lastName: "Smith"});return d;}) FAILED test: updateWhileLoading 1029 ms Error: test timeout in makeChanges ERROR IN: (function makeChanges(t) {var d = new doh.Deferred;jsonStore.fetch({queryOptions: {cache: true}, query: {lastName: "Smith", firstName: "*"}, sort: [{attribute: "firstName", descending: true}], onComplete: function (items, request) {t.is(5, items.length);t.is(newJack, items[4]);console.log("items[4]", items[4]);var newJoe = jsonStore.newItem({firstName: "Joe", lastName: "Smith"});t.is(5, items.length);jsonStore.updateResultSet(items, request);t.is(6, items.length);t.is(newJoe, items[1]);var jackJones = jsonStore.newItem({firstName: "Jack", lastName: "Jones"});jsonStore.updateResultSet(items, request);t.is(6, items.length);jsonStore.setValue(newJoe, "firstName", "Jesse");jsonStore.updateResultSet(items, request);t.is(6, items.length);t.is(newJoe, items[3]);t.f(newJoe == items[1]);jsonStore.deleteItem(newJack);jsonStore.updateResultSet(items, request);t.is(5, items.length);jsonStore.setValue(newJoe, "lastName", "Baker");jsonStore.updateResultSet(items, request);t.is(4, items.length);jsonStore.setValue(jackJones, "lastName", "Smith");jsonStore.updateResultSet(items, request);t.is(5, items.length);}});console.log("sent first");var finished;jsonStore.fetch({query: {lastName: "Smith", firstName: "Jack"}, sort: [{attribute: "firstName", descending: true}], onComplete: function (items, request) {console.log("items first", items);finished = true;t.is(1, items.length);d.callback(true);}});console.log("sent seconds");t.f(finished);return d;}) FAILED test: makeChanges 1032 ms Error: test timeout in cachedResults ERROR IN: (function cachedResults(t) {var d = new doh.Deferred;var finished;jsonStore.fetch({query: {lastName: "Smith", firstName: "Jack"}, sort: [{attribute: "firstName", descending: true}], onComplete: function (items, request) {console.log("items", items);finished = true;t.is(1, items.length);d.callback(true);}});t.t(finished);return d;}) FAILED test: cachedResults 1053 ms Error: test timeout in repeatedQueries ERROR IN: (function repeatedQueries(t) {var d = new doh.Deferred;var finished;jsonStore.fetch({queryOptions: {cache: true}, query: {}, onComplete: function (items, request) {console.log("items", items);t.is(6, items.length);jsonStore.newItem({firstName: "Jack", lastName: "Jones"});jsonStore.fetch({query: {}, onComplete: function (items, request) {t.is(7, items.length);}});jsonStore.serverVersion = jsonStore._updates.length;jsonStore.newItem({firstName: "Jack", lastName: "Jones"});jsonStore.fetch({query: {}, onComplete: function (items, request) {finished = true;t.is(8, items.length);d.callback(true);}});}});return d;}) FAILED test: repeatedQueries 1010 ms Error: test timeout in sorting ERROR IN: (function sorting(t) {var d = new doh.Deferred;var finished;jsonStore.fetch({query: {lastName: "Smith", firstName: "*"}, sort: [{attribute: "firstName", descending: true}], onComplete: function (items, request) {var last = jsonStore.getValue(items[0], "firstName");console.log("last name: ", last, items[0]);t.is("John", last);jsonStore.fetch({query: {lastName: "Smith", firstName: "*"}, sort: [{attribute: "firstName"}], onComplete: function (items, request) {var first = jsonStore.getValue(items[0], "firstName");console.log("first name", first, items[0]);finished = true;t.is("Jack", first);d.callback(true);}});}});t.t(finished);return d;}) FAILED test: sorting 1067 ms WOOHOO!! ------------------------------------------------------------ | TEST SUMMARY: ------------------------------------------------------------ 5 tests in 1 groups 5 errors 0 failures
In [27485]: