Skip to content

Commit

Permalink
BUG: only check children if index houses a Nestable. Root should neve…
Browse files Browse the repository at this point in the history
…r need to be fetched
  • Loading branch information
tangkong committed Dec 11, 2024
1 parent e7d5588 commit 6a41f5f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions superscore/widgets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,16 @@ def canFetchMore(self, parent: QtCore.QModelIndex) -> bool:

data = item._data

has_uuid_children = (
any(isinstance(dc_child, UUID) for dc_child in data.children)
or any(isinstance(ei_child._data, UUID) for ei_child in item._children)
)
if isinstance(data, Nestable) and has_uuid_children:
return True
# Root should never need to be fetched, since we fill to depth
# of 2 when we initialize the tree, and root is always at depth 0 if
# present
if isinstance(data, Nestable):
if (
any(isinstance(dc_child, UUID) for dc_child in data.children)
or any(isinstance(ei_child._data, UUID) for ei_child
in item._children)
):
return True

return False

Expand Down

0 comments on commit 6a41f5f

Please sign in to comment.