Fix device selection reset issue in LED Strip Testing

- Fix frontend device selection state management to properly update selected board when boards_changed event is triggered
- Optimize backend board status checking to only emit boards_changed events when there are actual changes
- Prevent unnecessary UI updates and improve performance

Fixes issue where device selection would reset to unselected state shortly after selection
This commit is contained in:
2025-07-08 02:46:24 +08:00
parent 92349eebb6
commit 9f37b4043c
2 changed files with 28 additions and 8 deletions

View File

@ -58,7 +58,10 @@ export const LedStripTest = () => {
board.port === currentBoard.port
);
if (!stillExists) {
if (stillExists) {
// Update to the new board object to reflect any status changes
setSelectedBoard(stillExists);
} else {
// Current board is no longer available, select first available or null
setSelectedBoard(boardList.length > 0 ? boardList[0] : null);
}