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

Compositor map not aware of widgets nested deep into the DOM on app startup #2254

Closed
rodrigogiraoserrao opened this issue Apr 11, 2023 · 2 comments · Fixed by #2684
Closed
Assignees
Labels
bug Something isn't working Task

Comments

@rodrigogiraoserrao
Copy link
Contributor

When working on #2031 we realised that there is an issue with the compositor _full_map on app startup, in that it does not contain the widgets that are nested within the DOM.

To reproduce:

  1. Run the app below and connect to the console.
  2. Press P after app startup and note the size of the map that is printed.
  3. Scroll the app to the very bottom.
  4. Press P again.
  5. Notice that the map that was printed now is significantly bigger.
App
from textual.app import App, ComposeResult
from textual.containers import VerticalScroll
from textual.widgets import Label


class MyApp(App[None]):
    def compose(self) -> ComposeResult:
        with VerticalScroll():
            yield Label("v\n" * 500)
            with VerticalScroll():
                for i in range(15):
                    yield Label(str(i))
                with VerticalScroll():
                    for i in range(35):
                        yield Label(str(i))

    def key_p(self) -> None:
        print(self.screen._compositor._full_map)


if __name__ == "__main__":
    MyApp().run()
@rodrigogiraoserrao rodrigogiraoserrao added bug Something isn't working Task labels Apr 11, 2023
@willmcgugan willmcgugan self-assigned this Apr 11, 2023
rodrigogiraoserrao added a commit that referenced this issue Apr 12, 2023
This test gets an xfail mark until #2254 is open.
willmcgugan pushed a commit that referenced this issue Apr 13, 2023
* Add --port option to textual console.

* Changelog.

* Address review feedback.

* Mark unpredictable test as xfail.

This test gets an xfail mark until #2254 is open.

* Make DEVTOOLS_PORT a constant.

Related review: https://github.com/Textualize/textual/pull/2258\#discussion_r1165210395

* Factor logic into function.

Related review: https://github.com/Textualize/textual/pull/2258\#discussion_r1165298259

* Remove dead import.
@willmcgugan willmcgugan removed their assignment May 24, 2023
@willmcgugan
Copy link
Collaborator

Unassigned myself from this. Up for grabs!

@github-actions
Copy link

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