From a8f98325352e9d3d8d26bbb42a8f7545c76e932b Mon Sep 17 00:00:00 2001 From: bruno Date: Sat, 11 Jul 2026 13:42:02 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20arbre=20collapse=20apr=C3=A8s=20drag-dro?= =?UTF-8?q?p=20(expanded=20persistant=20via=20localStorage)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avant: tout window.location.reload() réinitialisait expanded={}, causant le collapse de tous les dossiers après un drop. Fix: - expanded initialisé depuis localStorage('fd_ws_expanded') - _saveExpandedState() sauve avant toute navigation/reload - _reloadAfterAction() = save + reload - toggleExpand, navigateToFolder, expandAll sauvent l'état - Tous les reload (create, rename, delete, move, upload) passent par _reloadAfterAction() --- app/templates/local_workspace.html | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/app/templates/local_workspace.html b/app/templates/local_workspace.html index 504474f..128e24e 100644 --- a/app/templates/local_workspace.html +++ b/app/templates/local_workspace.html @@ -300,7 +300,10 @@ document.addEventListener('alpine:init', function() { newName:'', parentFolder:null, target:null, - expanded: {}, + expanded: (function() { + try { return JSON.parse(localStorage.getItem('fd_ws_expanded') || '{}'); } + catch(e) { return {}; } + })(), currentFolder: {{ current_folder_id }}, searchQuery: '', @@ -429,6 +432,7 @@ document.addEventListener('alpine:init', function() { toggleExpand(id, btn) { this.expanded[id] = !(this.expanded[id] || false); this.expanded = Object.assign({}, this.expanded); + this._saveExpandedState(); // For renderChildren static HTML: toggle chevron + sibling