-
Notifications
You must be signed in to change notification settings - Fork 5
feat: toast notification when Runme backend is unavailable #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,7 @@ import { | |||||||||||||||||||||||||||||||||||
| useCallback, | ||||||||||||||||||||||||||||||||||||
| useEffect, | ||||||||||||||||||||||||||||||||||||
| useMemo, | ||||||||||||||||||||||||||||||||||||
| useRef, | ||||||||||||||||||||||||||||||||||||
| useState, | ||||||||||||||||||||||||||||||||||||
| useSyncExternalStore, | ||||||||||||||||||||||||||||||||||||
| } from "react"; | ||||||||||||||||||||||||||||||||||||
|
|
@@ -38,6 +39,7 @@ import { useCurrentDoc } from "../../contexts/CurrentDocContext"; | |||||||||||||||||||||||||||||||||||
| import { useRunners } from "../../contexts/RunnersContext"; | ||||||||||||||||||||||||||||||||||||
| import { DEFAULT_RUNNER_PLACEHOLDER } from "../../lib/runtime/runnersManager"; | ||||||||||||||||||||||||||||||||||||
| import React from "react"; | ||||||||||||||||||||||||||||||||||||
| import { toast } from "sonner"; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| type TabPanelProps = React.HTMLAttributes<HTMLDivElement> & { | ||||||||||||||||||||||||||||||||||||
| "data-state"?: "active" | "inactive"; | ||||||||||||||||||||||||||||||||||||
|
|
@@ -338,6 +340,7 @@ export function Action({ cellData, isFirst }: { cellData: CellData; isFirst: boo | |||||||||||||||||||||||||||||||||||
| } | null>(null); | ||||||||||||||||||||||||||||||||||||
| const [pid, setPid] = useState<number | null>(null); | ||||||||||||||||||||||||||||||||||||
| const [exitCode, setExitCode] = useState<number | null>(null); | ||||||||||||||||||||||||||||||||||||
| const connectionTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||||||||||||||
| if (!contextMenu) { | ||||||||||||||||||||||||||||||||||||
|
|
@@ -383,9 +386,50 @@ export function Action({ cellData, isFirst }: { cellData: CellData; isFirst: boo | |||||||||||||||||||||||||||||||||||
| }, [contextMenu]); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| const runCode = useCallback(() => { | ||||||||||||||||||||||||||||||||||||
| cellData.run(); | ||||||||||||||||||||||||||||||||||||
| // Clear any pending connection timeout from a previous run. | ||||||||||||||||||||||||||||||||||||
| if (connectionTimeoutRef.current) { | ||||||||||||||||||||||||||||||||||||
| clearTimeout(connectionTimeoutRef.current); | ||||||||||||||||||||||||||||||||||||
| connectionTimeoutRef.current = null; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| const runID = cellData.run(); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| if (!runID) { | ||||||||||||||||||||||||||||||||||||
| toast.error("No runner configured. Check your runner settings in the console.", { | ||||||||||||||||||||||||||||||||||||
| id: "no-runner", | ||||||||||||||||||||||||||||||||||||
| duration: 5000, | ||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+395
to
+401
|
||||||||||||||||||||||||||||||||||||
| const runID = cellData.run(); | |
| if (!runID) { | |
| toast.error("No runner configured. Check your runner settings in the console.", { | |
| id: "no-runner", | |
| duration: 5000, | |
| }); | |
| try { | |
| cellData.run(); | |
| } catch (error) { | |
| toast.error( | |
| "No runner configured. Check your runner settings in the console.", | |
| { | |
| id: "no-runner", | |
| duration: 5000, | |
| }, | |
| ); |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is described as adding a toast when the Runme backend is unavailable, but this hunk changes the global "Add cell" button behavior to insert a markup (markdown) cell (and adds new NotebookData markup cell APIs/tests). If this is intentional, the PR description should be updated; otherwise, consider moving these notebook/markup-cell changes into a separate PR to keep scope aligned and reduce review risk.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cellData.run()is typed to returnvoid(NotebookData/CellDatastill definerun(): void), sorunIDhere is alwaysundefinedandif (!runID)always executes. In practice, every Run click will show the "No runner configured" toast and return early from this handler even when a runner is configured and execution was started, which makes the new availability logic incorrect for normal runs.Useful? React with 👍 / 👎.