Skip to content

Commit bffa84f

Browse files
Don't block inside _reload.
Address review feedback by handling the error of trying to load a directory that doesn't exist instead of checking if it exists. Review comment: https://github.com/Textualize/textual/pull/4123\#discussion_r1479504901
1 parent 43f15d8 commit bffa84f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/textual/widgets/_directory_tree.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,8 @@ async def _reload(self, node: TreeNode[DirEntry]) -> None:
256256
reopening = to_reopen.pop()
257257
if not reopening.data:
258258
continue
259-
if (
260-
reopening.allow_expand
261-
and (reopening.data.path in currently_open or reopening == node)
262-
and reopening.data.path.exists()
259+
if reopening.allow_expand and (
260+
reopening.data.path in currently_open or reopening == node
263261
):
264262
try:
265263
content = await self._load_directory(reopening).wait()
@@ -471,7 +469,7 @@ def _directory_content(self, location: Path, worker: Worker) -> Iterator[Path]:
471469
except PermissionError:
472470
pass
473471

474-
@work(thread=True)
472+
@work(thread=True, exit_on_error=False)
475473
def _load_directory(self, node: TreeNode[DirEntry]) -> list[Path]:
476474
"""Load the directory contents for a given node.
477475

0 commit comments

Comments
 (0)