Repository navigation
fix: stop console initialization after unmount - #320
Conversation
|
|
|
|
No actionable comments were generated in the recent review.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/lib/components/console/HeadlessConsole.svelte" line_range="43" />
<code_context>
+
onMount(async () => {
const py = await getPy();
+ if (disposed)
+ return;
await initConsole();
</code_context>
<issue_to_address>
**Abandoned mounts overwrite console state**
When the component is destroyed while `initConsole()` is pending, `initConsole()` continues into `py.runPythonAsync(...)` and redefines the shared console and helper globals after navigation, so a later mount can observe state overwritten by the abandoned mount.
Prevent `initConsole()` from running Python initialization or changing shared globals after the component is disposed.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: src/lib/components/console/HeadlessConsole.svelte:43
Skip console setup when navigation finishes before Pyodide or the console module loads. Check cancellation before changing Python globals, detach output callbacks on unmount and ignore late updates. Report console initialization failures with a Reload action.
Verified deferred initialization and cleanup with the real Svelte component in Chromium. Production-preview failure injection also confirms the error appears and Reload restores a working console. Combined build, lint and type checks pass (24 existing warnings).
Closes #319.