Skip to content
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

A lone Static results in a TooManyMatches error when using query_one #2723

Closed
davep opened this issue Jun 2, 2023 · 3 comments · Fixed by #2755
Closed

A lone Static results in a TooManyMatches error when using query_one #2723

davep opened this issue Jun 2, 2023 · 3 comments · Fixed by #2755
Labels
bug Something isn't working Task

Comments

@davep
Copy link
Contributor

davep commented Jun 2, 2023

I've not dived into this beyond knocking up this example to isolate what I saw (about to head out of the door but wanted to record this as a reminder). With 0.27.0 (perhaps before too, just noting the version here for the record), this code:

from textual.app     import App, ComposeResult
from textual.widgets import Static

class OneStatic( App[ None ] ):

    def compose( self ) -> ComposeResult:
        yield Static()

    def on_mount( self ) -> None:
        self.query_one( Static ).update( "Hello, World!" )

if __name__ == "__main__":
    OneStatic().run()

results in a TooManyMatches error being raised from the query_one. With very early testing this only seems to be the case with Static (at least, I tested with Label and Button and they're fine).

I think most people would rightly find this surprising.

@davep davep added bug Something isn't working Task labels Jun 2, 2023
davep added a commit to davep/textual-sandbox that referenced this issue Jun 2, 2023
@TomJGooding
Copy link
Contributor

TomJGooding commented Jun 2, 2023

Looks like the problem is that the new Tooltip is mounted which inherits from Static?

@willmcgugan
Copy link
Collaborator

Ahh. Good call. Might have to think about how to do things like tooltips without being visible in the DOM.

@github-actions
Copy link

github-actions bot commented Jun 8, 2023

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
Labels
bug Something isn't working Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants