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
Prevent autosave of 0 and wait until some code is loaded (#5)
Myles Scolnickf8da1fabfe09
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsxindex 3ae931fec8..bd579e5e03 100644--- a/frontend/src/App.tsx+++ b/frontend/src/App.tsx@@ -126,6 +126,11 @@ export const App: React.FC<AppProps> = ({ initialMode, userConfig }) => {// Save the notebook with the given filenameconst saveNotebook = useEvent((filename: string, showToast: boolean) => {+ // Don't save if there are no cells+ if (codes.length === 0) {+ return;+ }+// Don't save if we are in read modeif (isReading) {return;diff --git a/frontend/src/components/app-config/user-config-form.tsx b/frontend/src/components/app-config/user-config-form.tsxindex 0e17846f0f..477a4c74a3 100644--- a/frontend/src/components/app-config/user-config-form.tsx+++ b/frontend/src/components/app-config/user-config-form.tsx@@ -71,6 +71,7 @@ export const UserConfigForm: React.FC = () => {disabled={form.getValues("save.autosave") !== "after_delay"}{...field}value={field.value / 1000}+ min={1}onChange={(e) =>field.onChange(Number.parseInt(e.target.value) * 1000)}diff --git a/frontend/src/core/config.ts b/frontend/src/core/config.tsindex 5aae2cf022..3e66cff874 100644--- a/frontend/src/core/config.ts+++ b/frontend/src/core/config.ts@@ -4,7 +4,11 @@ import { assertExists } from "../utils/assertExists";const SaveConfigSchema = z.object({autosave: z.enum(["off", "after_delay"]),- autosave_delay: z.number().nonnegative(),+ autosave_delay: z+ .number()+ .nonnegative()+ // Ensure that the delay is at least 1 second+ .transform((millis) => Math.max(millis, 1000)),});const CompletionConfigSchema = z.object({diff --git a/frontend/src/css/App.css b/frontend/src/css/App.cssindex e27214da74..f9aacbc055 100644--- a/frontend/src/css/App.css+++ b/frontend/src/css/App.css@@ -5,6 +5,7 @@@import url("CodeMirrorSearchPanel.css");/* stylelint-disable unit-allowed-list */+/* On smaller screens, scale everything down so more fits on the page. */html {font-size: 90%;diff --git a/frontend/src/css/globals.css b/frontend/src/css/globals.cssindex e07edd2b4b..97f6fec957 100644--- a/frontend/src/css/globals.css+++ b/frontend/src/css/globals.css@@ -86,37 +86,51 @@.dark {/* sage-2 */--background: 150 7.7% 10.2%;+/* sage-12 */--foreground: 155 7% 93%;+/* sage-3 */--muted: 151 5.5% 15.2%;+/* sage-11 */--muted-foreground: 155 5% 68.3%;+/* sage-3 */--popover: 151 5.5% 15.2%;+/* sage-11 */--popover-foreground: 155 5% 68.3%;+/* sage-3 */--card: 151 5.5% 15.2%;+/* sage-11 */--card-foreground: 155 5% 68.3%;+/* sage-6 */--border: 153 3.7% 24.2%;+/* sage-7 */--input: 154 3.3% 28.7%;+/* cyan-3 */--primary: 193 52.6% 14.1%;+/* cyan-12 */--primary-foreground: 190 80% 84%;+/* sage-12 */--secondary: 155 7% 93%;+/* cyan-3 */--secondary-foreground: 193 51.9% 11.9%;- /* cyan-7*/++ /* cyan-7 */--accent: 192 56.6% 26.5%;+/* cyan-11 */--accent-foreground: 190 90% 54%;---destructive: 0 63% 41%;--destructive-foreground: 155 7% 93%;--success: 130 100% 70%;