Skip to content

891 switch to setup page when selected machine disconnected#925

Merged
kraemr merged 6 commits intomasterfrom
891-switch-to-setup-page-when-selected-machine-disconnected
Dec 7, 2025
Merged

891 switch to setup page when selected machine disconnected#925
kraemr merged 6 commits intomasterfrom
891-switch-to-setup-page-when-selected-machine-disconnected

Conversation

@EinsPommes
Copy link
Copy Markdown
Collaborator

This fix includes both backend and frontend changes:

  • Backend: The serial device detection loop now properly detects disconnections
    by always checking the device list, even when empty
  • Frontend: The UI monitors the machines list and automatically navigates to
    setup when the active machine disappears

Copilot AI review requested due to automatic review settings November 30, 2025 08:27
@EinsPommes EinsPommes linked an issue Nov 30, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 addresses issue #891 by implementing machine disconnection detection on both backend and frontend. The backend fix ensures the serial device detection loop properly handles empty device lists (enabling disconnection detection), while the frontend adds navigation logic to redirect users to the setup page when their active machine disconnects.

However, the PR also includes unrelated changes to the Laser1 interface that modify how roundness values are displayed (converting from ratio to percentage), which appears to be separate functionality bundled into this PR.

Key Changes:

  • Backend serial discovery now processes empty device lists to detect disconnections
  • Frontend monitors machine list and auto-navigates to setup on disconnection
  • Roundness display changed from ratio (0-1) to percentage (0-100) across Laser1 UI

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
server/src/main.rs Removed conditional check so handle_serial_device_hotplug is called even with empty device lists, enabling disconnection detection
electron/src/components/SidebarLayout.tsx Added useEffect hook to monitor machines and redirect to setup page when active machine disconnects
electron/src/machines/laser/laser1/Laser1Graph.tsx Transformed roundness data from ratio to percentage and updated graph display (unrelated to disconnection fix)
electron/src/machines/laser/laser1/Laser1ControlPage.tsx Updated roundness display to show percentage instead of ratio (unrelated to disconnection fix)
electron/src/control/units.tsx Added "%" as a supported unit type (unrelated to disconnection fix)

Comment thread electron/src/machines/laser/laser1/Laser1Graph.tsx Outdated
Comment thread electron/src/machines/laser/laser1/Laser1Graph.tsx Outdated
Comment thread electron/src/machines/laser/laser1/Laser1Graph.tsx Outdated
Comment thread electron/src/components/SidebarLayout.tsx Outdated
Comment thread electron/src/components/SidebarLayout.tsx
@kraemr kraemr force-pushed the 891-switch-to-setup-page-when-selected-machine-disconnected branch from 9da242f to 064d43a Compare December 1, 2025 09:53
Copy link
Copy Markdown
Collaborator

@kraemr kraemr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve these two issues, then its pretty much mergeable. Btw we usually do one issue --> One pull request not two issues -> One Pull. For smaller tickets this is fine, but just keep it in mind.

Comment thread electron/src/machines/laser/laser1/Laser1Graph.tsx Outdated
Comment thread electron/src/components/SidebarLayout.tsx Outdated
@EinsPommes EinsPommes force-pushed the 891-switch-to-setup-page-when-selected-machine-disconnected branch 2 times, most recently from 9da242f to db5c63a Compare December 1, 2025 19:27
@kraemr kraemr force-pushed the 891-switch-to-setup-page-when-selected-machine-disconnected branch from db5c63a to 0586326 Compare December 3, 2025 10:35
@kraemr
Copy link
Copy Markdown
Collaborator

kraemr commented Dec 3, 2025

@EinsPommes Fix the Ci failure

@EinsPommes EinsPommes force-pushed the 891-switch-to-setup-page-when-selected-machine-disconnected branch from 19082fc to 51d41c9 Compare December 3, 2025 15:39
@kraemr kraemr force-pushed the 891-switch-to-setup-page-when-selected-machine-disconnected branch from 11e6737 to 57a906f Compare December 4, 2025 10:16
@EinsPommes
Copy link
Copy Markdown
Collaborator Author

The errors have been fixed. Is there anything else that needs to be fixed? (Can I merge it?)

The app now detects when a machine disconnects and redirects you
to the setup page. Before, it would just stay on the machine page
even though the machine was gone.

Fixed both backend (USB detection) and frontend (auto-navigation).
Added error handling for parseInt and pathMatch array access.
@kraemr kraemr force-pushed the 891-switch-to-setup-page-when-selected-machine-disconnected branch from c23d8fd to 9abb762 Compare December 7, 2025 10:56
@kraemr kraemr merged commit f44cd02 into master Dec 7, 2025
4 checks passed
@kraemr kraemr deleted the 891-switch-to-setup-page-when-selected-machine-disconnected branch December 7, 2025 10:59
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.

Switch to setup page when selected machine disconnected

4 participants