@@ -43,7 +43,7 @@ const DeckyErrorBoundary: FunctionComponent<DeckyErrorBoundaryProps> = ({ error,
4343 const [ selectedBranch , setSelectedBranch ] = useSetting < UpdateBranch > ( 'branch' , UpdateBranch . Stable ) ;
4444 const [ isChecking , setIsChecking ] = useState < boolean > ( false ) ;
4545 const [ updateProgress , setUpdateProgress ] = useState < number > ( - 1 ) ;
46- const [ versionToUpdateTo , setSetVersionToUpdateTo ] = useState < string > ( "" ) ;
46+ const [ versionToUpdateTo , setSetVersionToUpdateTo ] = useState < string > ( '' ) ;
4747
4848 useEffect ( ( ) => {
4949 const a = DeckyBackend . addEventListener ( 'updater/update_download_percentage' , ( percentage ) => {
@@ -174,45 +174,61 @@ const DeckyErrorBoundary: FunctionComponent<DeckyErrorBoundaryProps> = ({ error,
174174 ) }
175175 { ! wasCausedByPlugin && (
176176 < div style = { { display : 'block' , marginBottom : '5px' } } >
177- { updateProgress > - 1 ? ( "Update in progress... " + updateProgress + "%" ) : updateProgress == - 2 ? 'Update complete. Restarting...' :
178- 'Changing your Decky Loader branch and/or \n checking for updates might help!\n' }
179- {
180- updateProgress == - 1 && (
181- < div style = { { height : '30px' } } >
182- < select style = { { height : '100%' } } onChange = { async ( e ) => {
177+ { updateProgress > - 1
178+ ? 'Update in progress... ' + updateProgress + '%'
179+ : updateProgress == - 2
180+ ? 'Update complete. Restarting...'
181+ : 'Changing your Decky Loader branch and/or \n checking for updates might help!\n' }
182+ { updateProgress == - 1 && (
183+ < div style = { { height : '30px' } } >
184+ < select
185+ style = { { height : '100%' } }
186+ onChange = { async ( e ) => {
183187 const branch = parseInt ( e . target . value ) ;
184188 setSelectedBranch ( branch ) ;
185- setSetVersionToUpdateTo ( "" ) ;
186- } } >
187- < option value = "0" selected = { selectedBranch == UpdateBranch . Stable } > Stable</ option >
188- < option value = "1" selected = { selectedBranch == UpdateBranch . Prerelease } > Pre-Release</ option >
189- < option value = "2" selected = { selectedBranch == UpdateBranch . Testing } > Testing</ option >
190- </ select >
191- < button
192- style = { { height : '100%' } }
193- disabled = { updateProgress != - 1 || isChecking }
194- onClick = { async ( ) => {
195- if ( versionToUpdateTo == "" ) {
196- setIsChecking ( true ) ;
197- const versionInfo = await DeckyBackend . callable ( 'updater/check_for_updates' ) ( ) as unknown as VerInfo ;
198- setIsChecking ( false ) ;
199- if ( versionInfo ?. remote && versionInfo ?. remote ?. tag_name != versionInfo ?. current ) {
200- setSetVersionToUpdateTo ( versionInfo . remote . tag_name ) ;
201- }
202- else {
203- setSetVersionToUpdateTo ( "" ) ;
204- }
189+ setSetVersionToUpdateTo ( '' ) ;
190+ } }
191+ >
192+ < option value = "0" selected = { selectedBranch == UpdateBranch . Stable } >
193+ Stable
194+ </ option >
195+ < option value = "1" selected = { selectedBranch == UpdateBranch . Prerelease } >
196+ Pre-Release
197+ </ option >
198+ < option value = "2" selected = { selectedBranch == UpdateBranch . Testing } >
199+ Testing
200+ </ option >
201+ </ select >
202+ < button
203+ style = { { height : '100%' } }
204+ disabled = { updateProgress != - 1 || isChecking }
205+ onClick = { async ( ) => {
206+ if ( versionToUpdateTo == '' ) {
207+ setIsChecking ( true ) ;
208+ const versionInfo = ( await DeckyBackend . callable (
209+ 'updater/check_for_updates' ,
210+ ) ( ) ) as unknown as VerInfo ;
211+ setIsChecking ( false ) ;
212+ if ( versionInfo ?. remote && versionInfo ?. remote ?. tag_name != versionInfo ?. current ) {
213+ setSetVersionToUpdateTo ( versionInfo . remote . tag_name ) ;
214+ } else {
215+ setSetVersionToUpdateTo ( '' ) ;
205216 }
206- else {
207- DeckyBackend . callable ( 'updater/do_update' ) ( ) ;
208- setUpdateProgress ( 0 ) ;
209- }
210- } }
211- > { isChecking ? "Checking for updates..." : versionToUpdateTo != "" ? 'Update to ' + versionToUpdateTo : 'Check for updates' }
212- </ button >
213- </ div >
214- )
215- }
217+ } else {
218+ DeckyBackend . callable ( 'updater/do_update' ) ( ) ;
219+ setUpdateProgress ( 0 ) ;
220+ }
221+ } }
222+ >
223+ { ' ' }
224+ { isChecking
225+ ? 'Checking for updates...'
226+ : versionToUpdateTo != ''
227+ ? 'Update to ' + versionToUpdateTo
228+ : 'Check for updates' }
229+ </ button >
230+ </ div >
231+ ) }
216232 </ div >
217233 ) }
218234 { wasCausedByPlugin && (
0 commit comments