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: prevent infinite re-render loop in grid layout read mode (#8644) (#8739)

Myles Scolnick7e3a65657531
diff --git a/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx b/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx
index 505589fa4f..8c52783dee 100644
--- a/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx
+++ b/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx
@@ -158,12 +158,19 @@ export const GridLayoutRenderer: React.FC<Props> = ({
compactType={null}
preventCollision={true}
rowHeight={layout.rowHeight}
- onLayoutChange={(cellLayouts) =>
+ onLayoutChange={(cellLayouts) => {
+ // Don't update state in read mode — the layout is static and
+ // updating triggers a re-render cycle that causes an infinite loop
+ // (React error https://react.dev/errors/185 Maximum update depth exceeded).
+ // https://github.com/marimo-team/marimo/issues/8644
+ if (isReading) {
+ return;
+ }
setLayout({
...layout,
cells: cellLayouts,
- })
- }
+ });
+ }}
droppingItem={
droppingItem
? {