-
Notifications
You must be signed in to change notification settings - Fork 841
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
Using dismiss
in call_after_refresh
now raises an error.
#5049
Comments
I'm not sure what may have changed, but why use a lambda rather than EDIT: Never mind, after taking a closer look I think this changed in #4789 with the warning below added to the
|
call_after_refresh will execute the callback within the screen's message pump. If it returns something awaitable (which The error is because it would end up waiting for itself to complete. i.e. a deadlock. it is an edge case. Can't think of any way to auto-detect that right now. However, I suspect it isn't necessary. From a quick look at your project I gather you want a refresh before the UI freezes. You almost certainly want to use workers to prevent freezing. I suspect that if you were to add |
Thanks a lot @TomJGooding @willmcgugan, thanks both! That all makes sense, thanks for the tip on using workers, looking forward to trying that out! I guess this will also allow the use of data loader widget which I was very keen on. Cheers! |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
I just wanted to highlight change in behaviour that I could not see documented in the change log. Previously I was calling
call_after_refresh(lambda: self.dismiss(True))
within aModalScreen
. Now, this gives an error:ScreenError: Can't await screen.dismiss() from the screen's message handler; try removing the await
I think because of a new check where this error is raised. I found another workaround to acheive what I wanted, but thought I'd raise this in case 1) this change in behaviour was not intended 2) an improved error mesage could be given. It took me a while to track it down, if suitable, if the error could indicate not to use
self.dismiss
incall_after_refresh
it might be useful.Sorry I cannot give clear versions on which this works / does not work. But it is OK in
0.71.0
but not in most recent version.The text was updated successfully, but these errors were encountered: