diff --git a/app/templates/local_workspace.html b/app/templates/local_workspace.html index fb502af..5c8fdc5 100644 --- a/app/templates/local_workspace.html +++ b/app/templates/local_workspace.html @@ -1209,23 +1209,16 @@ window._wsInitData = (function() { this.undoItemId = node.db_id || node.id; this.undoMessage = 'Deleted "' + (node.name || 'item') + '"'; this.undoVisible = true; - // Soft-delete: actually delete after timeout + // Delete via API var r = await fetch('/api/local-workspace/items/' + this.undoItemId, { method:'DELETE' }); if (!r.ok) { this.undoVisible = false; return; } - // Remove from tree immediately - this._removeFromTree(this.tree, this.undoItemId); - if (!this.searchQuery && !this.filterType && !this.sortBy) this.displayTree = [...this.tree]; - else if (this.sortBy) this.doSort(); - else this.doFilter(); - // Auto-dismiss + permanent after 5s + // Reload from API for reliability (sidebar refresh handled by _reloadAfterAction) + this._reloadAfterAction(); + // Auto-dismiss undo banner after 5s this.undoTimeout = setTimeout(function() { self.undoVisible = false; self.undoItemId = null; }, 5000); - // Directly refresh sidebar tree - if (window.appState && window.appState.refreshSidebarTree) { - window.appState.refreshSidebarTree(); - } }, undoDelete() { if (this.undoTimeout) clearTimeout(this.undoTimeout);