Skip to content

Commit

Permalink
Avoid cache of embed script
Browse files Browse the repository at this point in the history
  • Loading branch information
skatiruas committed Apr 5, 2024
1 parent d715416 commit 5c94622
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script async defer src="//www.instagram.com/embed.js"></script>
</body>
</html>
6 changes: 6 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export function App(): ReactElement {

updateOffset();
window.addEventListener("resize", updateOffset);
window.onload = function () {
const embedScript = document.createElement("script");
embedScript.async = true;
embedScript.src = `https://www.instagram.com/embed.js?version=${Date.now()}`;
document.head.appendChild(embedScript);
};

return () => window.removeEventListener("resize", updateOffset);
}, []);
Expand Down

0 comments on commit 5c94622

Please sign in to comment.