Skip to content

Commit a418d43

Browse files
committed
Revoke blob inside setTimeout.
1 parent 8099087 commit a418d43

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

client/modules/Preview/EmbedFrame.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,14 @@ function EmbedFrame({ files, isPlaying, basePath, gridOutput, textOutput }) {
302302
content: htmlDoc
303303
};
304304
const htmlUrl = createBlobUrl(generatedHtmlFile);
305-
if (srcRef.current) {
306-
blobUtil.revokeObjectURL(srcRef.current);
307-
}
305+
const toRevoke = srcRef.current;
308306
srcRef.current = htmlUrl;
309307
// BRO FOR SOME REASON YOU HAVE TO DO THIS TO GET IT TO WORK ON SAFARI
310308
setTimeout(() => {
311309
doc.src = htmlUrl;
310+
if (toRevoke) {
311+
blobUtil.revokeObjectURL(toRevoke);
312+
}
312313
}, 0);
313314
} else {
314315
doc.src = '';

0 commit comments

Comments
 (0)