- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 6.9k
 
fix: child monitors disappear after group deletion #6287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: child monitors disappear after group deletion #6287
Conversation
d532c01    to
    bc30559      
    Compare
  
    | 
           Could you help me with the GitHub Actions? I can't retry them and I don't understand the error...  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds functionality to properly handle children of group monitors when the parent group is deleted. Before deletion, the code now unlinks all child monitors from the group and notifies the frontend to update the UI for each affected child monitor.
Key changes:
- Fetches the group monitor before deletion to check its type
 - Retrieves and unlinks all children if the monitor is a group type
 - Sends frontend updates for each child monitor to reflect the parent removal
 
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for (const child of children) { | ||
| await server.sendUpdateMonitorIntoList(socket, child.id); | ||
| } | 
    
      
    
      Copilot
AI
    
    
    
      Oct 29, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sequential await calls inside a loop can cause performance issues. Consider using Promise.all() to send updates concurrently: await Promise.all(children.map(child => server.sendUpdateMonitorIntoList(socket, child.id)));
| for (const child of children) { | |
| await server.sendUpdateMonitorIntoList(socket, child.id); | |
| } | |
| await Promise.all(children.map(child => server.sendUpdateMonitorIntoList(socket, child.id))); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think Promise.all() fits here. It could mess up event ordering in Socket.IO, overload the DB with parallel queries (especially on SQLite), and wouldn’t bring much performance gain since the main cost is network latency. A better approach would be a batched update method like sendMultipleUpdatesMonitorIntoList(socket, childIds), doing one DB query and one socket emit for all children at once. WDYT ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected, Code LGTM
Thanks for tackling this 🎉
Regarding your questions:
I think this would be a good improvement to the user experience. I wanted to know what you thought before working on it.
Yes, making this configurable like that is likely a good idea.
Why are the package.json and package-lock.json versions not synchronized? Should I push the package-lock.json update?
We had a bug in our release script, thus the version in the package-lock was not updated. This should be fixed automatically in the next release.
❗ Important Announcements
Click here for more details:
🚫 Please Avoid Unnecessary Pinging of Maintainers
We kindly ask you to refrain from pinging maintainers unless absolutely necessary. Pings are for critical/urgent pull requests that require immediate attention.
📋 Overview
What problem does this pull request address?
When deleting a monitor group that contains child monitors, the child monitors visually disappear from the monitor list until the page is refreshed. This creates a confusing user experience as it appears the monitors have been deleted along with the group, when in reality they still exist in the database.
What features or functionality does this pull request introduce or enhance?
This PR ensures that when a monitor group is deleted, all child monitors are properly unlinked and immediately repositioned at the root level in the UI without requiring a page refresh.
Questions
Why are the package.json and package-lock.json versions not synchronized? Should I push the package-lock.json update?
In the issue linked I noticed @Justinzobel gave two good ideas:
"Are you sure you want to delete this monitor?"based on the status of the checkbox,"Are you sure you want to delete this group?"and"Are you sure you want to delete this group and its monitors?"I think this would be a good improvement to the user experience. I wanted to know what you thought before working on it.
🛠️ Type of change
📄 Checklist
📷 Screenshots or Visual Changes
Before

Groupdeletion without refreshingAfter

Groupdeletion without refreshingUPDOWN