mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Perform the "is loaded" test in _add_to_load_queue
The test if a node was loaded wasn't being performed when loading the root. This ensures that will happen. I suspect this is (no pun...) at the root of the issue with https://github.com/Textualize/frogmouth/issues/50 even though I can't see the route into how this happens, and can't recreate this at will. This feels like a worthwhile change to make anyway as it's a safer approach.
This commit is contained in:
@@ -131,8 +131,9 @@ class DirectoryTree(Tree[DirEntry]):
|
||||
node: The node to add to the load queue.
|
||||
"""
|
||||
assert node.data is not None
|
||||
node.data.loaded = True
|
||||
self._load_queue.put_nowait(node)
|
||||
if not node.data.loaded:
|
||||
node.data.loaded = True
|
||||
self._load_queue.put_nowait(node)
|
||||
|
||||
def reload(self) -> None:
|
||||
"""Reload the `DirectoryTree` contents."""
|
||||
@@ -351,8 +352,7 @@ class DirectoryTree(Tree[DirEntry]):
|
||||
if dir_entry is None:
|
||||
return
|
||||
if self._safe_is_dir(dir_entry.path):
|
||||
if not dir_entry.loaded:
|
||||
self._add_to_load_queue(event.node)
|
||||
self._add_to_load_queue(event.node)
|
||||
else:
|
||||
self.post_message(self.FileSelected(event.node, dir_entry.path))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user