Skip to content

Commit 217030e

Browse files
authored
Merge pull request #277 from pathsim/feature/eager-pyodide-init
Eagerly initialize Pyodide on page mount
2 parents 42e4e27 + 3163c14 commit 217030e

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/routes/+page.svelte

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -502,17 +502,18 @@
502502
const continueTooltip = { text: "Continue", shortcut: "Shift+Enter" };
503503
504504
onMount(() => {
505-
// Auto-detect same-origin Flask backend (pip package mode), then check URL params
506-
autoDetectBackend().then(() => initBackendFromUrl());
507-
508-
// Re-install runtime toolboxes from previous sessions and seed any
509-
// preloaded catalog entries on first launch. Internally short-circuits
510-
// when there's no work to do, so we can call it unconditionally.
505+
// Bring up the Python backend the moment the page loads so the
506+
// runtime is ready by the time the user clicks Run. Order matters:
507+
// detect the active backend first, then initialise it, then run
508+
// the toolbox bootstrap on top.
511509
(async () => {
512510
try {
511+
await autoDetectBackend();
512+
await initBackendFromUrl();
513+
await initPyodide();
513514
await bootstrapToolboxes();
514515
} catch (e) {
515-
console.error('[toolbox bootstrap]', e);
516+
console.error('[startup]', e);
516517
}
517518
})();
518519

0 commit comments

Comments
 (0)