Skip to content

Commit

Permalink
Updates CDN url helper
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmerfield committed Nov 22, 2024
1 parent beb01f5 commit 345cf75
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/documentation/tools/cdn-url-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ const cache = {};
module.exports = ({ cacheID, viewDirectory }) => {
return () => (text, render) => {
const path = render(text);
const cacheKey = `${cacheID}-${path}`;

let identifier = cache[cacheID]; // Check if the result is already cached
let identifier = cache[cacheKey]; // Check if the result is already cached

if (!identifier) {
try {
Expand All @@ -19,7 +20,7 @@ module.exports = ({ cacheID, viewDirectory }) => {
// console.log('hashed', path, identifier);

// Cache the result for future use
cache[cacheID] = identifier;
cache[cacheKey] = identifier;
} catch (e) {
console.log("failed to hash", path, e);
// if the file doesn't exist, we'll use the cacheID
Expand Down

0 comments on commit 345cf75

Please sign in to comment.