-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update dstore/Cache::put #154
Conversation
src/Cache.js
Outdated
cachingStore.remove((directives && directives.id) || this.getIdentity(object)); | ||
return when(this.inherited(arguments), function (result) { | ||
cachingStore.put(object, directives); | ||
return when(this.inherited(arguments)).then(function (result) { | ||
// now put result in cache | ||
var cachedPutResult = | ||
cachingStore.put(object && typeof result === 'object' ? result : object, directives); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be reduced to an if
, since if result is not an object, we've already done this prior to calling inherited.
This looks good to me. |
1dbb25d
to
a5655fe
Compare
I think this one needs a rebase. We have enough things to do a 1.2 release soon so we should rebase and land this if time permits @kitsonk. |
Yeah, the rebase totally screwed up... 😢 This is simply too stale. |
Previous behaviour was to remove the item while waiting for return from the master store. Now Cache will presume the update will complete and only remove the item if the master store rejects the `put`.
A cherry-pick to a new branch worked. |
Previous behaviour was to remove the item while waiting for return from the master store. Now Cache will presume the update will complete and only remove the item if the master store rejects the
put
.Fixes #117.