Skip to content

Fix for the issue of Deleting multiple sensors at once.#850

Open
JerryVincent wants to merge 1 commit intodevfrom
fix/deleteSensorIssue
Open

Fix for the issue of Deleting multiple sensors at once.#850
JerryVincent wants to merge 1 commit intodevfrom
fix/deleteSensorIssue

Conversation

@JerryVincent
Copy link
Collaborator

@JerryVincent JerryVincent commented Mar 25, 2026

Type of Change

  • Dependency upgrade
  • Bug fix (non-breaking change)
  • Breaking change
    • e.g. a fixed bug or new feature that may break something else
  • New feature
  • Code quality improvements
    • e.g. refactoring, documentation, tests, tooling, ...

Implementation

The bug was in the post-save cleanup loop in the device/$deviceId/edit/sensors route - when iterating forward and calling splice, removing an element shifts the array left, causing the next element to land on the same index that the loop then skips over. The fix changes the loop to iterate backwards (from the last element to the first), so any splice only affects elements that have already been processed, guaranteeing no sensor is skipped. The duplicate new && notValidInput branch was also removed since it was redundant.

Checklist

  • I gave this pull request a meaningful title
  • My pull request is targeting the dev branch
  • I have added documentation to my code
  • I have deleted code that I have commented out

Additional Information

@github-actions
Copy link

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 69.53% 1714 / 2465
🔵 Statements 67.8% 1786 / 2634
🔵 Functions 69.35% 353 / 509
🔵 Branches 56.63% 935 / 1651
File CoverageNo changed files found.
Generated in workflow #2287 for commit 29829bb by the Vitest Coverage Report Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI state not updated correctly when two consecutive sensors are deleted simultaneously

1 participant