Skip to content

Commit f334d88

Browse files
author
Ives van Hoorne
committed
Move the firstRun check to after transpilation
1 parent c5cb2b8 commit f334d88

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

packages/app/src/sandbox/compile.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -343,25 +343,6 @@ async function compile({
343343
type: 'start',
344344
});
345345

346-
try {
347-
// We set it as a time value for people that run two sandboxes on one computer
348-
// they execute at the same time and we don't want them to conflict, so we check
349-
// if the message was set a second ago
350-
if (
351-
firstLoad &&
352-
localStorage.getItem('running') &&
353-
Date.now() - localStorage.getItem('running') > 1000
354-
) {
355-
localStorage.removeItem('running');
356-
showRunOnClick();
357-
return;
358-
}
359-
360-
localStorage.setItem('running', Date.now());
361-
} catch (e) {
362-
/* no */
363-
}
364-
365346
const startTime = Date.now();
366347
try {
367348
inject();
@@ -469,6 +450,25 @@ async function compile({
469450
if (!skipEval) {
470451
resetScreen();
471452

453+
try {
454+
// We set it as a time value for people that run two sandboxes on one computer
455+
// they execute at the same time and we don't want them to conflict, so we check
456+
// if the message was set a second ago
457+
if (
458+
firstLoad &&
459+
localStorage.getItem('running') &&
460+
Date.now() - localStorage.getItem('running') > 8000
461+
) {
462+
localStorage.removeItem('running');
463+
showRunOnClick();
464+
return;
465+
}
466+
467+
localStorage.setItem('running', Date.now());
468+
} catch (e) {
469+
/* no */
470+
}
471+
472472
manager.preset.preEvaluate(manager);
473473

474474
if (!manager.webpackHMR && !manager.preset.htmlDisabled) {

0 commit comments

Comments
 (0)