From 1a7feeca31e114158c2905d83fb80d8fdd1be3db Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Mon, 16 Oct 2023 18:21:53 +0100 Subject: [PATCH] Await the tree reload when the path changes in DirectoryTree --- src/textual/widgets/_directory_tree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/textual/widgets/_directory_tree.py b/src/textual/widgets/_directory_tree.py index 1d6f00be64..7ba6679f6a 100644 --- a/src/textual/widgets/_directory_tree.py +++ b/src/textual/widgets/_directory_tree.py @@ -244,13 +244,13 @@ def validate_path(self, path: str | Path) -> Path: """ return self.PATH(path) - def watch_path(self) -> None: + async def watch_path(self) -> None: """Watch for changes to the `path` of the directory tree. If the path is changed the directory tree will be repopulated using the new value as the root. """ - self.reload() + await self.reload() def process_label(self, label: TextType) -> Text: """Process a str or Text into a label. Maybe overridden in a subclass to modify how labels are rendered.