fix: implement lazy widget loading and store references
Defer widget creation from __init__ to compose() and store references as instance variables to prevent garbage collection and initialization order issues. This resolves ScreenStackError during TUI startup. Changes: - Move LogPane, GraphOverview, ChatRepl creation to compose() - Store widgets as instance variables (self.log_pane, etc) - Restore Horizontal/Vertical container layout Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,14 +53,18 @@ class AdenTUI(App):
|
||||
def __init__(self, runtime: AgentRuntime):
|
||||
super().__init__()
|
||||
self.runtime = runtime
|
||||
self.log_pane = LogPane()
|
||||
self.graph_view = GraphOverview()
|
||||
self.chat_repl = ChatRepl(runtime)
|
||||
# Widgets will be created lazily in compose()
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
"""Create child widgets for the app."""
|
||||
yield Header()
|
||||
|
||||
# Lazy-load widgets here to avoid initialization order issues
|
||||
# Store as instance variables to prevent garbage collection
|
||||
self.log_pane = LogPane()
|
||||
self.graph_view = GraphOverview()
|
||||
self.chat_repl = ChatRepl(self.runtime)
|
||||
|
||||
yield Horizontal(
|
||||
Container(self.graph_view, id="left-pane"),
|
||||
Vertical(
|
||||
|
||||
Reference in New Issue
Block a user