Skip to content

Commit

Permalink
OPTIONS type requests should be cached the same way as GET type requets.
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-vlasenko committed Oct 11, 2021
1 parent 8fca518 commit 86b9711
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/api-fetch/src/middlewares/preloading.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ function createPreloadingMiddleware( preloadedData ) {
cache[ method ] &&
cache[ method ][ path ]
) {
return Promise.resolve(
parse
? cache[ method ][ path ].body
: cache[ method ][ path ]
);
const cacheData = cache[ method ][ path ];

// Unsetting the cache key ensures that the data is only preloaded a single time
delete cache[ method ][ path ];

return Promise.resolve( parse ? cacheData.body : cacheData );
}
}

Expand Down

0 comments on commit 86b9711

Please sign in to comment.