[Bug]: Files "Folder tree" navigation registers and renders one navigation view per folder (no virtualization): 12,490 DOM items, 7.1 s page load and a 2.3 s long task with 4,140 subfolders
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- javascript, typescript
- Domaine
- frontend, performance
Piste de recherche
Start with apps/files/src/views/folderTree.ts and apps/files/src/components/FilesNavigationListItem.vue, then reproduce with a folder containing 4,000+ subfolders using the browser Performance tools. The issue describes excessive navigation items and main thread blocking; a fix should keep the folder tree responsive and render or load children efficiently. The proposed approaches involve changes to tree ownership, loading, rendering, and indexing, so scope the design before implementation.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
⚠️ This issue respects the following points: ⚠️
- This is not a troubleshooting question, general support matter, or webserver/proxy problem, but likely a bug (if unsure, ask the Community Help Forum).
- This issue is not already reported on Github OR solved at the Community Help Forum (I've searched!).
- I'm using a maintained major version of Nextcloud Server and tested against the latest patch level. (Supported major versions and current patch levels).
- I agree to follow Nextcloud's Code of Conduct.
- I've tried my best to provide clear reproduction steps that someone unfamiliar with this bug could use to reproduce it.
Bug description
The "Folder tree" navigation view (Nextcloud 30+, apps/files/src/views/folderTree.ts) registers one navigation view per folder (Navigation.register(...views)) and the navigation panel renders one NcAppNavigationItem per view, recursively, without any virtualization. With a folder that contains 4,140 subfolders, opening it renders 12,490 items in the navigation panel, the page load goes from 0.82 s to 7.1 s, and the longest blocking task on open goes from 75 ms to 2.3 s (main thread frozen). The whole app stays sluggish afterwards because every reactive change re-evaluates childViews for every item.
Limiting the server response (see the companion server-side issue about ApiController::getChildren(), #65904) is not enough: the panel also registers the folders already loaded by the files list (updateTreeChildren() reuses the files store), so the cost is paid as soon as the folder is opened.
Actual behavior
| Measurement (Chrome, same account, same folder with 4,140 subfolders) | Folder tree enabled | Folder tree disabled |
|---|---|---|
| Items rendered in the navigation panel | 12,490 | 32 |
| Page load of the folder with 4,140 subfolders | 7.1 s | 0.82 s |
Page load of a project folder 3 levels below it (/<clients>/<client>/<project>/<subfolder>) |
3.1 s | 0.63 s |
| Longest blocking task on open | 2.3 s | 75 ms |
| Jump of the files list to a given entry | 0.4–0.8 s | 0.2–0.28 s |
Server side, the folder-tree request itself is fast (~0.2 s with the fix proposed in #65904); the time is spent in the browser.
Root cause
apps/files/src/views/folderTree.ts (identical on stable34 and master):
registerNodeViews()(L87–L110) builds oneIViewper folder (generateNodeView(), L119–L139) and callsNavigation.register(...views)(L110) — 4,140 views for one folder, every one of them a reactive entry ofNavigation.views.
https://github.com/nextcloud/server/blob/3c5546a1a84230af62c981e9512d977656ee459c/apps/files/src/views/folderTree.ts#L87-L139updateTreeChildren()(L171–L183) registers the folders already present in the files store (L173–L178), otherwise fetches two levels at once (getFolderTreeNodes(path, 2), L181), so expanding a node loads and registers the grandchildren too.apps/files/src/components/FilesNavigationListItem.vuerenders oneNcAppNavigationItemper view and recurses (v-for="childView in sortedChildViews"), and for each item computeschildViewsby filtering all visible views (views.value.filter((v) => v.parent === props.view.id), L32–L36): O(views²) on every change (12,490² ≈ 155 M comparisons).
https://github.com/nextcloud/server/blob/07b7a0f600708c90ba94ede238818c215536d4bf/apps/files/src/components/FilesNavigationListItem.vue#L30-L66
Proposed fix
- Virtualize the tree panel (render only the visible rows, e.g. with
vue-virtual-scrollerwhich the Files app already ships, on a flattened array of{ node, level, expanded }), or at least paginate children per node ("show more" beyond N entries). - Lazy-load one level on expand only (
depth=1), do not pre-register grandchildren, and do not turn every folder into a navigationIView: keep one view for the tree and let the component own its node tree. - Index children by parent once (a
Map<parentId, IView[]>) instead of filtering all views per item. - Sort with a cached
Intl.Collator(numeric, base sensitivity).
Feasibility: a quick prototype injected into the same page (virtualized list in place of the panel content, same look) on the same 4,140 subfolders renders 24 items instead of 12,490, first paint in 85 ms, 67 ms per scroll jump, and sorts the 4,140 names in 1.3 ms with Intl.Collator, with the same order as the files list.
Steps to reproduce
- Create a folder with 4,000+ subfolders (empty subfolders are enough).
- Keep the default "Enable folder tree" setting (Files → settings).
- Open that folder in the Files app with the browser's performance tools recording (Long Tasks / Performance tab).
- Count the items in the left navigation panel (
document.querySelectorAll('[data-cy-files-navigation-item]').length). - Compare with the same folder after disabling the folder tree (
occ user:setting <uid> files folder_tree 0, reload).
Expected behavior
The navigation panel should render only the visible rows (virtualized or paginated list), load children lazily on expand only, and never block the main thread for seconds. Opening a folder should cost about the same with or without the folder tree.
Nextcloud Server version
34
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.4
Web server
Other
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
- Nextcloud Server 34.0.3 —
folderTree.tsunchanged onmasteras of 2026-10-24 (3c5546a1a84230af62c981e9512d977656ee459c) and onstable34(07b7a0f600708c90ba94ede238818c215536d4bf). The folder tree view was introduced by #46596 / #47122 (Nextcloud 30); #58273 (Nextcloud 34) reuses the files store but does not change the one-view-per-folder design. - Server: Ubuntu 24.04 LTS, PHP 8.4, PostgreSQL 16, Caddy 2 (FastCGI to php-fpm — hence "Other" above). Client: Chrome, current stable.
- The only workaround today is to disable the folder tree per account (
occ user:setting <uid> files folder_tree 0), which removes the feature; the default is hard-coded totrue(apps/files/lib/Service/UserConfig.php), so new accounts get it back. - Companion server-side issue: #65904 (the API computes and discards the listings of all subfolders).
- Measurement protocol:
PerformanceObserveronlongtaskentries + time to first rendered rows; happy to share the script and to test a fix on the real tree.
- Langage dominant
- PHP
- Étoiles
- 37.5k
- Forks
- 5.4k
- Merge moyen
- 1 j 13 h
- PR mergées (30 j)
- 639
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de nextcloud/server
-
35-feedback
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
0. Needs triage 35-feedback bug
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
Les mainteneurs répondent en général sous 1 jour
-
workflowengine: File entity reuses the node of the first "Tag assigned" event for all later events in the same processPeut-être pris @lazerg l’a pris il y a 2 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
Les mainteneurs répondent en général sous 1 jour
-
Contacts import aborts with TypeError when vCards have no UID (TextImporter structure)Peut-être pris @SebastianKrupinski l’a pris il y a 6 jours. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
nextcloud/server#66486 · 2 commentaires · 2 réactions · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Unified search: screen reader hears "No matching results" on mobile even when there are resultsPeut-être pris @lazerg l’a pris il y a 10 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de nextcloud/server
Issues similaires
-
[Sync EN] stream: document the errors of the stream_context_*() and stream filter functions (#6091)Ouvertesync-en
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
Automattic/blocks-engine#6318 ·
Les mainteneurs répondent en général sous 1 jour
-
Update: Laravel Cheat Sheet - middleware examples for the bootstrap/app.php layout (small update)Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
OWASP/CheatSheetSeries#2990 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour