Fix: Angular child folder deletion causes 404 error and tree collapse #21822

Back

Description

Deleting a child folder from the folder content table triggered a 404 HTTP error and collapsed the entire directory tree to root.

Root causeDirectoryTreeService.setupListener() had two subscriptions on directoryDelete$. The second one (feeding refreshNode) was incorrectly mapping the deleted folder's own ID as newParentId:

// Before (broken)
this.updateStream.directoryDelete$.pipe(map(val => ({ newParentId: val }))),

This caused refreshNode to call findAncestors with the deleted folder's ID, then attempt directoryService.getList(deletedId)404, since the folder no longer exists. When the folder wasn't in the loaded tree at all, findAncestors returned empty parents, triggering updateDirectories() with no args — collapsing the entire tree to root.

Fix — Map the deleted folder to its parent before passing to refreshNode:

// After (fixed)
this.updateStream.directoryDelete$.pipe(map(id => ({ newParentId: this.getParentOf(id) }))),

refreshNode now rebuilds from the still-existing parent folder up to root, consistent with how rename/move operations work.

Checklist

  • I fully tested it as developer / designer and created unit / integration tests
  • I documented it (or no need to document or I will create a separate documentation issue)
  • I worked with the design team to get their idea for UI/UX design (or no need to design for this PR)
  • I've assigned reviewer, related labels and set a milestone for this PR

How to test it?

  1. Open the file management UI and navigate into a folder containing at least one child folder.
  2. Delete the child folder via the entity action menu (ellipsis → Delete).
  3. Confirm deletion.
  4. Verify: no error toast/console 404, and the directory tree on the left retains its expanded state with the deleted folder removed from the parent's children.
Original prompt

This section details on the original issue you should resolve

<issue_title>Angular - Child folder deletion is broken</issue_title>
<issue_description>### Description

When we delete a child folder we are getting such error

https://github.com/user-attachments/assets/3203a876-cdd4-4597-8ab5-18af00f9ec46

It is not supposed to give such error and collapse all child folders.</issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes volosoft/volo#21821

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Version
10.2.0-rc.2
Release Date
09 March, 2026
Labels
No labels
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.