Skip to content

Commit

Permalink
Local fix to dojo#218
Browse files Browse the repository at this point in the history
Because this hasn't been fixed upstream, I'm fixing it here.

Adding an object to a cache-backed Rest store causes what should be a
POST call to turn into a PUT call with a random id.
  • Loading branch information
yassam committed Mar 9, 2021
1 parent d36bf51 commit bf910a2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,14 @@ define([
// first update the cache, we are going to assume the update is valid while we wait to
// hear from the master store
var cachingStore = this.cachingStore;
cachingStore.put(object, directives);
// Yasir 2021-03-10: The following cachingStore.put() has
// been commented out. See https://github.com/SitePen/dstore/issues/218
// If you're adding a new element with a cache backed Rest store,
// the following calls adds a random ID which turns the POST in
// the following Rest call into a PUT which fails. As per the bug report above
// let Rest do its thing then update the cache afterwards.
//
// --- cachingStore.put(object, directives);
return when(this.inherited(arguments)).then(function (result) {
// now put result in cache
var cachedPutResult =
Expand Down

0 comments on commit bf910a2

Please sign in to comment.