From dda54aafd8aefe3ca8b96bde9c3c4dceb8cafeab Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Oct 2025 16:15:28 +0000 Subject: [PATCH 1/3] Initial plan From 206fe633aa932a33b586d7e511ad091a22257c98 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Oct 2025 16:22:47 +0000 Subject: [PATCH 2/3] Fix Toolbar initialization for Solara compatibility Use hold_trait_notifications() context manager to batch trait updates during Toolbar.__init__() to prevent premature widget serialization that causes errors in Solara environment. Co-authored-by: giswqs <5016453+giswqs@users.noreply.github.com> --- geemap/toolbar.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/geemap/toolbar.py b/geemap/toolbar.py index 1dc84d3e93..b677af4b00 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 From 170fd186fa623ea907024a11b7ed4b5d845b2b22 Mon Sep 17 00:00:00 2001 From: Qiusheng Wu Date: Thu, 30 Oct 2025 13:15:24 -0400 Subject: [PATCH 3/3] Fix comment formatting in toolbar.py --- geemap/toolbar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geemap/toolbar.py b/geemap/toolbar.py index b677af4b00..07fcddc470 100644 --- a/geemap/toolbar.py +++ b/geemap/toolbar.py @@ -128,7 +128,7 @@ def __init__( reset=True, ) # Use hold_trait_notifications to avoid triggering widget serialization - # during initialization, which can cause issues in Solara and other environments + # 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