Automatically fetch first level of subfolders for root nodes in folder status model
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 26 Feb 2024 09:45:53 +0000 (17:45 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 5 Mar 2024 03:48:05 +0000 (11:48 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/folderstatusmodel.cpp

index dea96feaac076b88b6cf0cc3c52f7db0dc8ce366..d974bf0fcdf5175f70d6a4dcabd56bc62fd4a9c2 100644 (file)
@@ -101,6 +101,14 @@ void FolderStatusModel::setAccountState(const AccountState *accountState)
 
     endResetModel();
     emit dirtyChanged();
+
+    // Automatically fetch the subfolders to prevent showing the expansion chevron if there are no subfolders
+    for (auto i = 0; i < _folders.size(); ++i) {
+        const auto idx = index(i);
+        if (canFetchMore(idx)) {
+            fetchMore(idx);
+        }
+    }
 }