Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: wait to render before downloading png (#864)

Myles Scolnickb0ffc866b485
diff --git a/frontend/src/components/editor/actions/useNotebookActions.tsx b/frontend/src/components/editor/actions/useNotebookActions.tsx
index 694901ef35..fc9761cc9e 100644
--- a/frontend/src/components/editor/actions/useNotebookActions.tsx
+++ b/frontend/src/components/editor/actions/useNotebookActions.tsx
@@ -115,13 +115,24 @@ export function useNotebookActions() {
icon: <ImageIcon size={14} strokeWidth={1.5} />,
label: "Download as PNG",
handle: async () => {
+ const toasted = toast({
+ title: "Starting download",
+ description: "Downloading as PNG...",
+ });
+
await runDuringPresentMode(async () => {
const app = document.getElementById("App");
if (!app) {
return;
}
+
+ // Wait 2 seconds for the app to render
+ await new Promise((resolve) => setTimeout(resolve, 2000));
+
await downloadHTMLAsImage(app, filename || "screenshot.png");
});
+
+ toasted.dismiss();
},
},
{