File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -432,7 +432,7 @@ const Connection: React.FC<ConnectionProps> = ({
432432 }
433433
434434 const connectToDevice = async ( ) => {
435- setIsLoading ( true ) ; // Set loading state to true
435+
436436 try {
437437 // Disconnect any previous connection if port is open
438438 if ( portRef . current && portRef . current . readable ) {
@@ -485,9 +485,12 @@ const Connection: React.FC<ConnectionProps> = ({
485485 } ) ;
486486 localStorage . setItem ( 'savedDevices' , JSON . stringify ( savedPorts ) ) ;
487487 setSelectedChannels ( [ 1 ] ) ; // Set channel 1 as the default
488+
488489 // Open the port with the determined baud rate
489490 await port . open ( { baudRate } ) ;
491+ setIsLoading ( true ) ; // Set loading state to true
490492 } else {
493+ setIsLoading ( true ) ; // Set loading state to true
491494 // If device is already found, retrieve its settings
492495 const info = port . getInfo ( ) ;
493496 const savedDevice = savedPorts . find (
You can’t perform that action at this time.
0 commit comments