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

Fix TabbedContent type errors #4243

Closed
wants to merge 2 commits into from

Conversation

davep
Copy link
Contributor

@davep davep commented Feb 29, 2024

Following on from #4234, fixes a couple of type errors in TabbedContent relating to adding and removing panes.

@davep davep added enhancement New feature or request Task labels Feb 29, 2024
@davep davep self-assigned this Feb 29, 2024
@@ -430,13 +432,19 @@ def add_pane(
pane = self._set_id(pane, tabs.tab_count + 1)
assert pane.id is not None
pane.display = False

async def _add_part(awaitable: AwaitComplete | AwaitMount) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem right. If you need to wrap those awaitables in a coroutine, it suggests that maybe AwaitComplete is type incorrectly.

Maybe AwaitComplete needs to accept an Awaitable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the code was wrong anyway, you mean, and the hint tweak is moot? If so I'll close this. Was just a passing tidy-up anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be correct, but the typing error stems from AwaitComplete

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I'll close this and flag up that AwaitComplete might need a wee bit more tinkering.

),
self.get_child_by_type(ContentSwitcher).mount(pane),
_add_part(self.get_child_by_type(ContentSwitcher).mount(pane)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually seems like a flaw. The AwaitCompete class runs its awaitables concurrently. This looks like something that should run in serial.

@willmcgugan
Copy link
Collaborator

Closing in favor of #4255

@willmcgugan willmcgugan closed this Mar 4, 2024
@davep
Copy link
Contributor Author

davep commented Mar 4, 2024

Beat me to it. Thanks.

@davep davep deleted the tabbed-content-type-errors branch March 4, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants