Skip to content

Commit

Permalink
fixed _getNodeAncestors (apache#23593)
Browse files Browse the repository at this point in the history
  • Loading branch information
darkhan.nausharipov committed Nov 5, 2022
1 parent 5978d37 commit 8807c00
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ class ContentTreeController extends ChangeNotifier {
notifyListeners();
}

List<String> _getNodeAncestors(NodeModel node, List<String> ancestors) {
List<String> _getNodeAncestors(NodeModel node, List<String> ancestorIds) {
if (node.parent != null) {
ancestors.add(node.parent!.id);
return _getNodeAncestors(node.parent!, ancestors);
} else {
return ancestors.reversed.toList();
return _getNodeAncestors(
node.parent!,
[...ancestorIds, node.parent!.id],
);
}
return ancestorIds.reversed.toList();
}

void _onContentTreeCacheChange() {
Expand Down

0 comments on commit 8807c00

Please sign in to comment.