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: correct flush of anywidget messages (#2620)

Myles Scolnicka02d8e1d0954
diff --git a/marimo/_plugins/ui/_impl/comm.py b/marimo/_plugins/ui/_impl/comm.py
index 87eacc51bc..88a3bc7688 100644
--- a/marimo/_plugins/ui/_impl/comm.py
+++ b/marimo/_plugins/ui/_impl/comm.py
@@ -145,6 +145,10 @@ class MarimoComm:
def flush(self) -> None:
if not self.ui_element_id:
+ # If there is no ui_element_id, then it has not been rendered
+ # to the frontend, and just exists in python
+ # We can drop these instead of holding onto them.
+ self._publish_message_buffer = []
return
from marimo._messaging.ops import SendUIElementMessage