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.

chore: upgrade react-compiler (#4664)

Myles Scolnick3e4a402c9519
diff --git a/biome.json b/biome.json
index f31109b050..87087b61cb 100644
--- a/biome.json
+++ b/biome.json
@@ -27,7 +27,7 @@
"useIframeTitle": "info",
"useKeyWithClickEvents": "off",
"useGenericFontNames": "off",
- "useSemanticElements": "warn",
+ "useSemanticElements": "off",
"useMediaCaption": "info"
},
"complexity": {
diff --git a/frontend/.eslintrc.cjs b/frontend/.eslintrc.cjs
index d3c212217e..a5c7c10af3 100644
--- a/frontend/.eslintrc.cjs
+++ b/frontend/.eslintrc.cjs
@@ -16,7 +16,7 @@ module.exports = {
// Accessibility
"plugin:jsx-a11y/strict",
// React
- "plugin:react-hooks/recommended",
+ "plugin:react-hooks/recommended-legacy",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:ssr-friendly/recommended",
@@ -38,9 +38,9 @@ module.exports = {
parserOptions: {
project: require.resolve("./tsconfig.json"),
},
- plugins: ["@typescript-eslint", "header", "react-compiler"],
+ plugins: ["@typescript-eslint", "header"],
rules: {
- "react-compiler/react-compiler": "warn",
+ "react-hooks/react-compiler": "warn",
"header/header": [
"error",
diff --git a/frontend/package.json b/frontend/package.json
index d3888a592a..d33c59a570 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -211,15 +211,14 @@
"@vitejs/plugin-react": "^4.4.1",
"@vitejs/plugin-react-swc": "^3.9.0",
"autoprefixer": "^10.4.21",
- "babel-plugin-react-compiler": "19.0.0-beta-e552027-20250112",
+ "babel-plugin-react-compiler": "19.1.0-rc.1",
"blob-polyfill": "^7.0.20220408",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-react": "^7.34.3",
- "eslint-plugin-react-compiler": "19.0.0-beta-8a03594-20241020",
- "eslint-plugin-react-hooks": "^4.6.2",
+ "eslint-plugin-react-hooks": "^6.0.0-rc.1",
"eslint-plugin-ssr-friendly": "^1.3.0",
"eslint-plugin-storybook": "^0.10.1",
"eslint-plugin-unicorn": "^54.0.0",
@@ -229,7 +228,7 @@
"postcss": "^8.5.3",
"postcss-plugin-namespace": "^0.0.3",
"react": "^18.3.1",
- "react-compiler-runtime": "19.0.0-beta-e552027-20250112",
+ "react-compiler-runtime": "19.1.0-rc.1",
"react-dom": "^18.3.1",
"react-test-renderer": "^18.3.1",
"storybook": "^8.6.9",
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 5844fe8981..7aa8c2d30d 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -530,8 +530,8 @@ importers:
specifier: ^10.4.21
version: 10.4.21([email protected])
babel-plugin-react-compiler:
- specifier: 19.0.0-beta-e552027-20250112
- version: 19.0.0-beta-e552027-20250112
+ specifier: 19.1.0-rc.1
+ version: 19.1.0-rc.1
blob-polyfill:
specifier: ^7.0.20220408
version: 7.0.20220408
@@ -550,12 +550,9 @@ importers:
eslint-plugin-react:
specifier: ^7.34.3
version: 7.34.3([email protected])
- eslint-plugin-react-compiler:
- specifier: 19.0.0-beta-8a03594-20241020
- version: 19.0.0-beta-8a03594-20241020([email protected])
eslint-plugin-react-hooks:
- specifier: ^4.6.2
- version: 4.6.2([email protected])
+ specifier: ^6.0.0-rc.1
+ version: 6.0.0([email protected])
eslint-plugin-ssr-friendly:
specifier: ^1.3.0
version: 1.3.0([email protected])
@@ -584,8 +581,8 @@ importers:
specifier: ^18.3.1
version: 18.3.1
react-compiler-runtime:
- specifier: 19.0.0-beta-e552027-20250112
- version: 19.0.0-beta-e552027-20250112([email protected])
+ specifier: 19.1.0-rc.1
+ version: 19.1.0-rc.1([email protected])
react-dom:
specifier: ^18.3.1
version: 18.3.1([email protected])
@@ -787,13 +784,6 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
- '@babel/[email protected]':
- resolution: {integrity: sha512-nutsvktDItsNn4rpGItSNV2sz1XwS+nfU0Rg8aCx3W3NOKVzdMjJRu0O5OkgDp3ZGICSTbgRpxZoWsxoKRvbeA==}
- engines: {node: '>=6.9.0'}
- deprecated: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-methods instead.
- peerDependencies:
- '@babel/core': ^7.0.0-0
-
resolution: {integrity: sha512-ryzI0McXUPJnRCvMo4lumIKZUzhYUO/ScI+Mz4YVaTLt04DHNSjEUjKVvbzQjZFLuod/cYEc07mJWhzl6v4DPg==}
engines: {node: '>=6.9.0'}
@@ -818,6 +808,12 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
+ '@babel/[email protected]':
+ resolution: {integrity: sha512-D/JUozNpQLAPUVusvqMxyvjzllRaF8/nSrP1s2YGQT/W4LHK4xxsMcHjhOGTS01mp9Hda8nswb+FblLdJornQw==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
resolution: {integrity: sha512-y8quW6p0WHkEhmErnfe58r7x0A70uKphQm8Sp8cV7tjNQwK56sNVK0M73LK3WuYmsuyrftut4xAkjjgU0twaMg==}
engines: {node: '>=6.9.0'}
@@ -4243,8 +4239,8 @@ packages:
resolution: {integrity: sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==}
engines: {node: '>=10', npm: '>=6'}
- resolution: {integrity: sha512-pUTT0mAZ4XLewC6bvqVeX015nVRLVultcSQlkzGdC10G6YV6K2h4E7cwGlLAuLKWTj3Z08mTO9uTnPP/opUBsg==}
+ resolution: {integrity: sha512-M4fpG+Hfq5gWzsJeeMErdRokzg0fdJ8IAk+JDhfB/WLT+U3WwJWR8edphypJrk447/JEvYu6DBFwsTn10bMW4Q==}
resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==}
@@ -5288,17 +5284,12 @@ packages:
peerDependencies:
eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8
- resolution: {integrity: sha512-bYg1COih1s3r14IV/AKdQs/SN7CQmNI0ZaMtPdgZ6gp1S1Q/KGP9P43w7R6dHJ4wYpuMBvekNJHQdVu+x6UM+A==}
- engines: {node: ^14.17.0 || ^16.0.0 || >= 18.0.0}
- peerDependencies:
- eslint: '>=7'
-
- resolution: {integrity: sha512-QzliNJq4GinDBcD8gPB5v0wh6g8q3SUi6EFF0x8N/BL9PoVs0atuGc47ozMRyOWAKdwaZ5OnbOEa3WR+dSGKuQ==}
- engines: {node: '>=10'}
+ resolution: {integrity: sha512-NyC3yIC9fazLitYiN8eHykV5wLp/SMuUZMh+sdPSHIeN4ReXIc7if40jtGjDplAgVL/4OkN1d9gneWe9lFZgag==}
+ engines: {node: '>=18'}
+ deprecated: This stable release was published by accident, please use 6.0.0-rc.1 instead.
peerDependencies:
- eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0
+ eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0
resolution: {integrity: sha512-aoW4MV891jkUulwDApQbPYTVZmeuSyFrudpbTAQuj5Fv8VL+o6df2xIGpw8B0hPjAaih1/Fb0om9grCdyFYemA==}
@@ -5800,11 +5791,11 @@ packages:
resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==}
- resolution: {integrity: sha512-SQpZK4BzR48kuOg0v4pb3EAGNclzIlqMj3Opu/mu7bbAoFw6oig6cEt/RAi0zTFW/iW6Iz9X9ggGuZTAZ/yZHg==}
+ resolution: {integrity: sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==}
- resolution: {integrity: sha512-BL5P83cwCogI8D7rrDCgsFY0tdYUtmFP9XaXtl2IQjC+2Xo+4okjfXintlTxcIwl4qeGddEl28Z11kbVIw0aNA==}
+ resolution: {integrity: sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==}
resolution: {integrity: sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==}
@@ -7486,8 +7477,8 @@ packages:
react: '>=16.8.0'
react-dom: '>=16.8.0'
- resolution: {integrity: sha512-GEeaCTe9UsEbNop0f6EAljFd82PvB3YCiZZPrxP0LbG0DVA5K4mOJ2D0zRpkxad/rCsT1SUo1KjBHSorRIdQug==}
+ resolution: {integrity: sha512-wCt6g+cRh8g32QT18/9blfQHywGjYu+4FlEc3CW1mx3pPxYzZZl1y+VtqxRgnKKBCFLIGUYxog4j4rs5YS86hw==}
peerDependencies:
react: ^17.0.0 || ^18.0.0 || ^19.0.0 || ^0.0.0-experimental
@@ -9434,14 +9425,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- dependencies:
- '@babel/core': 7.26.10
- '@babel/helper-create-class-features-plugin': 7.25.9(@babel/[email protected])
- '@babel/helper-plugin-utils': 7.26.5
- transitivePeerDependencies:
- - supports-color
-
dependencies:
'@babel/core': 7.26.10
@@ -9466,6 +9449,14 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ dependencies:
+ '@babel/core': 7.26.10
+ '@babel/helper-create-class-features-plugin': 7.25.9(@babel/[email protected])
+ '@babel/helper-plugin-utils': 7.26.5
+ transitivePeerDependencies:
+ - supports-color
+
dependencies:
'@babel/core': 7.26.10
@@ -13837,7 +13828,7 @@ snapshots:
cosmiconfig: 7.0.1
resolve: 1.22.8
dependencies:
'@babel/types': 7.27.0
@@ -15099,22 +15090,18 @@ snapshots:
safe-regex-test: 1.0.3
string.prototype.includes: 2.0.0
dependencies:
'@babel/core': 7.26.10
'@babel/parser': 7.27.0
- '@babel/plugin-proposal-private-methods': 7.18.6(@babel/[email protected])
+ '@babel/plugin-transform-private-methods': 7.25.9(@babel/[email protected])
eslint: 8.57.0
- hermes-parser: 0.20.1
+ hermes-parser: 0.25.1
zod: 3.24.2
zod-validation-error: 3.4.0([email protected])
transitivePeerDependencies:
- supports-color
- dependencies:
- eslint: 8.57.0
-
dependencies:
array-includes: 3.1.8
@@ -15752,11 +15739,11 @@ snapshots:
dependencies:
'@types/hast': 3.0.4
dependencies:
- hermes-estree: 0.20.1
+ hermes-estree: 0.25.1
dependencies:
@@ -17696,7 +17683,7 @@ snapshots:
- '@codemirror/lint'
- '@codemirror/search'
dependencies:
react: 18.3.1
diff --git a/frontend/src/hooks/useAudioRecorder.ts b/frontend/src/hooks/useAudioRecorder.ts
index ef6418bca4..28aabc2a19 100644
--- a/frontend/src/hooks/useAudioRecorder.ts
+++ b/frontend/src/hooks/useAudioRecorder.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useState, useRef, useEffect } from "react";
+import { useState, useRef } from "react";
import { useTimer } from "./useTimer";
import useEvent from "react-use-event-hook";
import { Logger } from "@/utils/Logger";
+import { useOnUnmount } from "./useLifecycle";
export type RecordingStatus = "recording" | "paused" | "stopped";
@@ -69,14 +70,11 @@ export function useAudioRecorder(opts: {
});
// Cleanup
- useEffect(() => {
- return () => {
- mediaRecorder.current?.stream.getTracks().forEach((t) => t.stop());
- mediaRecorder.current?.stop();
- timer.stop();
- };
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, []);
+ useOnUnmount(() => {
+ mediaRecorder.current?.stream.getTracks().forEach((t) => t.stop());
+ mediaRecorder.current?.stop();
+ timer.stop();
+ });
return {
start,
diff --git a/frontend/src/hooks/useLifecycle.ts b/frontend/src/hooks/useLifecycle.ts
index c55158cdd8..202b689aab 100644
--- a/frontend/src/hooks/useLifecycle.ts
+++ b/frontend/src/hooks/useLifecycle.ts
@@ -8,3 +8,13 @@ export function useOnMount(effect: EffectCallback) {
// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(effect, []);
}
+
+/**
+ * Wrapper around useEffect that makes it clearer that the effect is run, just on unmount.
+ */
+export function useOnUnmount(effect: EffectCallback) {
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ useEffect(() => {
+ return effect();
+ }, []);
+}
diff --git a/frontend/src/hooks/useResizeObserver.ts b/frontend/src/hooks/useResizeObserver.ts
index 9a848f4897..26c7d74b57 100644
--- a/frontend/src/hooks/useResizeObserver.ts
+++ b/frontend/src/hooks/useResizeObserver.ts
@@ -32,7 +32,7 @@ export function useResizeObserver<T extends HTMLElement = HTMLElement>(
// eslint-disable-next-line react/hook-use-state
const previousSize = useRef<Size>({ ...initialSize });
const onResize = useRef<((size: Size) => void) | undefined>(undefined);
- // eslint-disable-next-line react-compiler/react-compiler
+ // eslint-disable-next-line react-hooks/react-compiler
onResize.current = options.onResize;
useEffect(() => {
diff --git a/frontend/src/plugins/impl/CodeEditorPlugin.tsx b/frontend/src/plugins/impl/CodeEditorPlugin.tsx
index f1fa9611b3..4e74ff5eb3 100644
--- a/frontend/src/plugins/impl/CodeEditorPlugin.tsx
+++ b/frontend/src/plugins/impl/CodeEditorPlugin.tsx
@@ -6,7 +6,7 @@ import { Labeled } from "./common/labeled";
import { type Theme, useTheme } from "@/theme/useTheme";
import { LazyAnyLanguageCodeMirror } from "./code/LazyAnyLanguageCodeMirror";
import { TooltipProvider } from "@/components/ui/tooltip";
-import { useCallback, useState, useMemo, useEffect } from "react";
+import { useState, useMemo, useEffect } from "react";
import { useDebounceControlledState } from "@/hooks/useDebounce";
import { EditorView } from "@codemirror/view";
import useEvent from "react-use-event-hook";
@@ -71,24 +71,20 @@ const CodeEditorComponent = (props: CodeEditorComponentProps) => {
disabled: !Number.isFinite(props.debounce),
});
+ const handleChange = useEvent((newValue: string) => {
+ setLocalValue((_) => newValue);
+ if (typeof props.debounce === "number") {
+ setValueDebounced(newValue);
+ } else if (!props.debounce) {
+ props.setValue(newValue);
+ }
+ });
// This is to sync the value from Python whenever the cell is updated
// as useState doesn't reinitialize on re-renders
useEffect(() => {
setLocalValue(props.value);
}, [props.value]);
- const handleChange = useCallback(
- (newValue: string) => {
- setLocalValue((_) => newValue);
- if (typeof props.debounce === "number") {
- setValueDebounced(newValue);
- } else if (!props.debounce) {
- props.setValue(newValue);
- }
- },
- [setValueDebounced, props.debounce, props.setValue],
- );
-
const onBlur = useEvent(() => {
props.setValue(localValue);
});