-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mutate_reactive not updating screen (w/ reactive list) #4799
Comments
There is a fix coming soon. BTW you only need to call |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
I think this isn't fixed. Here is a minimal example: from textual.app import App, ComposeResult
from textual.widgets import Static, Button
from textual.reactive import reactive
class TestWidget(Static):
msg: reactive[list[str]] = reactive(list, recompose=True)
def compose(self) -> ComposeResult:
yield Static(" ".join(self.msg))
class TestApp(App):
msg: reactive[list[str]] = reactive(list, recompose=True)
def compose(self) -> ComposeResult:
yield TestWidget()
yield Button("Click me", id="button").data_bind(TestApp.msg)
def on_button_pressed(self, event: Button.Pressed) -> None:
self.msg.append("Hello")
self.mutate_reactive(TestApp.msg)
if __name__ == "__main__":
app = TestApp()
app.run() Running this I get the error |
@Banbury Did you intend to call |
Oops. Don't type while tired. :) |
Problem
RadioSet is not updating as expected when a dynamic list is built with reactive
MRE Expectation
on_mount appends all files in directory to a reactive list. mutate_reactive will cause the RadioSet to be rebuild with the updated list values.
Versions
MRE
assumes directory called configs exists; assumes files within config directory
Current Workaround
data_bind in Screen
The text was updated successfully, but these errors were encountered: