-
Notifications
You must be signed in to change notification settings - Fork 780
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
Handle other Tabs widgets as DOM descendants of a TabbedContent #3602
Conversation
Thanks Darren, this looks like a better way of handling this. I still don't quite understand how I think the docstring is a bit misleading for |
@TomJGooding I think on your attempt, the So, when that watcher was called, the tab_count was actually 2, triggering the early return. Since this early return prevented I don't think I've explained great, but the whole flow is very confusing with lots of messages, reactive updates, and side effects happening - it's really not easy to trace execution here. |
Sorry just to confirm I meant my change to the early return in #3444 (comment). I tried both |
I think that's a race-condition. |
Actually - this doesn't work as the |
…o that it can ignore messages from other, irrelevant Tabs instances that may exist as descendants deeper in the DOM. Also adds some tests to ensure corresponding issues are fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Darren, this obviously was more involved than I expected from my attempt!
My only suggestion is could we also change this misleading docstring for _on_tabs_cleared
please?
…TabbedContent - it now includes a note that the Cleared message is sent when all tabs are hidden.
The key change here is that when a
TabbedContent
creates itsTabs
, it'll be able to easily identify messages from that instance.This is important because
TabbedContent
should only be responding to messages from theTabs
it creates. Messages from otherTabs
instances that may appear further down the DOM as descendants should be ignored.Also fixes #3412, which was a crash.