Skip to content

Commit

Permalink
Merge pull request #3245 from processing/cache-busting
Browse files Browse the repository at this point in the history
add cache busting to assets in preview
  • Loading branch information
raclim authored Oct 8, 2024
2 parents 184448c + 340600a commit 5cd2e53
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion client/modules/Preview/previewIndex.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ const App = () => {
}
}

function addCacheBustingToAssets(files) {
const timestamp = new Date().getTime();
return files.map((file) => {
if (file.url) {
return {
...file,
url: `${file.url}?v=${timestamp}`
};
}
return file;
});
}

useEffect(() => {
const unsubscribe = listen(handleMessageEvent);
return function cleanup() {
Expand All @@ -62,7 +75,7 @@ const App = () => {
<React.Fragment>
<GlobalStyle />
<EmbedFrame
files={state}
files={addCacheBustingToAssets(state)}
isPlaying={isPlaying}
basePath={basePath}
gridOutput={gridOutput}
Expand Down

0 comments on commit 5cd2e53

Please sign in to comment.