-
Notifications
You must be signed in to change notification settings - Fork 814
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
Don't allow screen instances in App.SCREENS #4893
Labels
good first issue
Good for newcomers
Comments
I can give this a go! |
Good catch re modifying the If that looks straightforward. You could do it in this PR. Otherwise, it could be a new issue. |
Sounds easy enough, I'll implement it in this PR. |
Added it under a new |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Textual currently allows a screen instance to be specified in the
SCREENS
classvar. This works fine when launching an app, until a second instance of the app runs. Re-using a previous instance breaks the app.See the example here: https://textual.textualize.io/guide/screens/#creating-a-screen
Note how the BSOD is given as an instance in a classvar, i.e.
SCREENS = {"bsod": BSOD()}
This would cause the instance to be shared if there is ever more than a single App.The easiest workaround is to disallow passing instances, and require a string or callable. So the above example should be
SCREENS = {"bsod": BSOD}
Requirements:
SCREENS
andMODES
TypeError
.The text was updated successfully, but these errors were encountered: