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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: wait for pdf (#1924)
Myles Scolnickf4452182f6b4
diff --git a/frontend/src/components/editor/actions/useNotebookActions.tsx b/frontend/src/components/editor/actions/useNotebookActions.tsxindex 1c94e647a5..5616bec141 100644--- a/frontend/src/components/editor/actions/useNotebookActions.tsx+++ b/frontend/src/components/editor/actions/useNotebookActions.tsx@@ -134,8 +134,8 @@ export function useNotebookActions() {return;}- // Wait 2 seconds for the app to render- await new Promise((resolve) => setTimeout(resolve, 2000));+ // Wait 3 seconds for the app to render+ await new Promise((resolve) => setTimeout(resolve, 3000));await downloadHTMLAsImage(app, document.title);});@@ -147,7 +147,16 @@ export function useNotebookActions() {icon: <FileIcon size={14} strokeWidth={1.5} />,label: "Print PDF",handle: async () => {+ const toasted = toast({+ title: "Starting download",+ description: "Downloading as PDF...",+ });+await runDuringPresentMode(async () => {+ // Wait 3 seconds for the app to render+ await new Promise((resolve) => setTimeout(resolve, 3000));+ toasted.dismiss();+const beforeprint = new Event("export-beforeprint");const afterprint = new Event("export-afterprint");function print() {diff --git a/frontend/src/components/ui/toast.tsx b/frontend/src/components/ui/toast.tsxindex 1edd966298..eb2aebf1f1 100644--- a/frontend/src/components/ui/toast.tsx+++ b/frontend/src/components/ui/toast.tsx@@ -1,7 +1,7 @@/* Copyright 2024 Marimo. All rights reserved. */import * as React from "react";import * as ToastPrimitives from "@radix-ui/react-toast";-import { VariantProps, cva } from "class-variance-authority";+import { type VariantProps, cva } from "class-variance-authority";import { X } from "lucide-react";import { cn } from "@/utils/cn";@@ -49,6 +49,7 @@ const Toast = React.forwardRef<ref={ref}className={cn(toastVariants({ variant: variant || "default" }),+ "print:hidden",className,)}{...props}