Opened 5 years ago

Last modified 2 years ago

#17567 assigned defect

dojo/store/Cache remove() method discards original XHR response of Master Store

Reported by: housik Owned by: Kris Zyp
Priority: undecided Milestone: 1.15
Component: Data Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:

Description

I'm using dGrid with Observable Cached JsonRest? store. I would like to have access to original XHR response of Master Store (JsonRest?) when I call store.remove() method - to read HTTP response headers. I would like to pass some additional data from server to browser - like number of total items available after calling store.remove() method.

But it is impossible, see https://github.com/dojo/dojo/blob/master/store/Cache.js at line 49.

remove() is returning result of method cachingStore.remove(id, directives) and masterStore response (original XHR response) is not passed - is lost forever.

Solution? Is it possible to include original XHR response of master store in response (promise) of cached store?

Change History (3)

comment:1 Changed 5 years ago by ben hockey

Owner: set to Kris Zyp
Status: newassigned

i think probably the only reason cachingStore.remove is returned is as a way to block the resolution of the returned promise. it probably makes sense (and is maybe more correct?) to have that promise resolve to the result of masterStore.remove:

remove: function(id, directives){
        return when(masterStore.remove(id, directives), function(result){
                return when(cachingStore.remove(id, directives)).then(function () {
                        return result;
                });
        });
},

comment:2 Changed 3 years ago by dylan

Milestone: tbd1.12

comment:3 Changed 2 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.