p5.js-web-editor icon indicating copy to clipboard operation
p5.js-web-editor copied to clipboard

Revoke outdated Blob URLs

Open lindapaiste opened this issue 2 years ago • 0 comments

Partial fix for #2234

This revokes the Blob URL which is assigned to the preview HTML document. I have not addressed the additional Blob URLs which are assigned to individual .js files as that's more complicated.

Changes:

  • EmbedFrame component stores its last-created Blob URL in a ref (srcRef).
  • It revokes the previous URL whenever it creates a new one.
  • I put the revocation inside the existing setTimeout to be safe, so that there is no chance of seeing a momentary flash of expired content.

I have verified that this pull request:

  • [x] has no linting errors (npm run lint)
  • [x] has no test errors (npm run test)
  • [x] is from a uniquely-named feature branch and is up to date with the develop branch.
  • [x] is descriptively named and links to an issue number, i.e. Fixes #123

lindapaiste avatar Jun 08 '23 02:06 lindapaiste