Fix variable indicators not updating when active environment is deleted

This commit is contained in:
Pavel Baksy 2026-05-12 01:17:12 +02:00
parent 1a35867871
commit 56e294debb

View File

@ -1255,6 +1255,7 @@ class RequestTabWidget(Gtk.Box):
# Set flag to indicate we're programmatically changing the dropdown
# This prevents the signal handler from triggering indicator updates during initialization
self._is_programmatically_changing_environment = True
old_env_id = self.selected_environment_id
try:
# Build string list with "None" + environment names
@ -1276,6 +1277,8 @@ class RequestTabWidget(Gtk.Box):
index = self.environment_ids.index(self.selected_environment_id)
self.environment_dropdown.set_selected(index)
except ValueError:
# Previously selected environment no longer exists
self.selected_environment_id = None
self.environment_dropdown.set_selected(0) # Default to "None"
else:
self.environment_dropdown.set_selected(0) # Default to "None"
@ -1284,8 +1287,9 @@ class RequestTabWidget(Gtk.Box):
# Always clear the flag
self._is_programmatically_changing_environment = False
# Note: Don't update indicators here as the request might not be loaded yet
# Indicators will be updated when environment changes or request is loaded
# If the effective environment changed (e.g. was deleted), update indicators
if self.selected_environment_id != old_env_id:
self._update_variable_indicators()
def _show_environment_selector(self):
"""Show environment selector (create if it doesn't exist)."""