diff --git a/geemap/toolbar.py b/geemap/toolbar.py index 1dc84d3e93..07fcddc470 100644 --- a/geemap/toolbar.py +++ b/geemap/toolbar.py @@ -127,8 +127,11 @@ def __init__( callback=self._toggle_callback, reset=True, ) - self.main_tools = main_tools + ([self.toggle_widget] if extra_tools else []) - self.extra_tools = extra_tools + # Use hold_trait_notifications to avoid triggering widget serialization + # during initialization, which can cause issues in Solara and other environments. + with self.hold_trait_notifications(): + self.main_tools = main_tools + ([self.toggle_widget] if extra_tools else []) + self.extra_tools = extra_tools for widget in self.main_tools + self.extra_tools: widget.callback_wrapper = lambda callback, value, tool: callback( self.host_map, value, tool