Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 2 additions & 21 deletions marimo/_plugins/ui/_impl/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import TYPE_CHECKING, Any, Callable, Optional, cast

from marimo._loggers import marimo_logger
from marimo._messaging.ops import SendUIElementMessage
from marimo._types.ids import WidgetModelId

if TYPE_CHECKING:
Expand Down Expand Up @@ -184,25 +185,7 @@ def _publish_msg(
metadata = {} if metadata is None else metadata
buffers = [] if buffers is None else buffers

if msg_type == COMM_OPEN_NAME:
self._publish_message_buffer.append(
MessageBufferData(
data, metadata, buffers, model_id=self.comm_id
)
)
self.flush()
return

if msg_type == COMM_MESSAGE_NAME:
self._publish_message_buffer.append(
MessageBufferData(
data, metadata, buffers, model_id=self.comm_id
)
)
self.flush()
return

if msg_type == COMM_CLOSE_NAME:
if msg_type in {COMM_OPEN_NAME, COMM_MESSAGE_NAME, COMM_CLOSE_NAME}:
self._publish_message_buffer.append(
MessageBufferData(
data, metadata, buffers, model_id=self.comm_id
Expand All @@ -218,8 +201,6 @@ def _publish_msg(
)

def flush(self) -> None:
from marimo._messaging.ops import SendUIElementMessage

while self._publish_message_buffer:
item = self._publish_message_buffer.pop(0)
SendUIElementMessage(
Expand Down