Skip to content

Commit

Permalink
Fix caching example by using .clone() method
Browse files Browse the repository at this point in the history
  • Loading branch information
sarunast committed Feb 2, 2022
1 parent 1727cb1 commit 15ea6f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/with-express/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ const client = prismic.createClient(endpoint, {

if (cache.has(key)) {
// If the cache contains a value for the key, return it
return cache.get(key);
return cache.get(key).clone();
} else {
// Otherwise, make the network request
const res = await fetch(url, options);

if (res.ok) {
// If the request was successful, save it to the cache
cache.set(key, res);
cache.set(key, res.clone());
}

return res;
Expand Down

0 comments on commit 15ea6f6

Please sign in to comment.