fix: accumulate devices in node map instead of overwriting each iteration#105
fix: accumulate devices in node map instead of overwriting each iteration#105peachest wants to merge 1 commit into
Conversation
…tion Signed-off-by: houyuxi <yuxi.hou@transwarp.io>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: peachest The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @peachest! It looks like this is your first PR to Project-HAMi/HAMi-WebUI 🎉 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesLocal node device append
Estimated review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Problem
In
updateLocalNodes(), when iterating over a node's devices, the code usesbizNode.Devicesas the base slice forappend:bizNodeis created once per node byfetchNodeInfo()and itsDevicesfield is alwaysnil(it only sets metadata like IP, Name, etc.). This means every iteration overwrites the previous device instead of accumulating:Fix
Use the accumulated slice
n[node.UID].Devicesinstead ofbizNode.Devices:So each device is appended to the growing list in the map entry.
Changes
server/internal/data/node.go— 1 line changed, 1 insertion, 1 deletionSummary by CodeRabbit