File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
apps/frontend/src/ui/hooks Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ interface SettingsControllerType {
1717 settings : ( ) => Settings ;
1818 saveOnLeave : ( settings : ( ) => Partial < Settings > ) => void ;
1919 save : ( settings : Settings ) => Promise < void > ;
20+ refetch : ( ) => void ;
2021}
2122
2223const SettingsContext = createContext ( ) as Context < SettingsControllerType > ;
@@ -44,6 +45,7 @@ export function SettingsProvider(props: ParentProps) {
4445 syncSettings ( settings ) ;
4546 await refetch ( ) ;
4647 } ,
48+ refetch,
4749 } ;
4850
4951 if ( getProgramInfo ( ) . dev_build )
@@ -65,6 +67,8 @@ export function useSettings() {
6567 if ( ! context )
6668 throw new Error ( 'useSettingsContext should be called inside its SettingsProvider' ) ;
6769
70+ context . refetch ( ) ;
71+
6872 return context ;
6973}
7074
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ pub async fn install_java_from_major(java_version: u32) -> crate::Result<PathBuf
5454 let package = packages
5555 . into_iter ( )
5656 . find ( |p| p. java_version . contains ( & java_version) )
57- . ok_or ( anyhow:: anyhow!(
57+ . ok_or_else ( || anyhow:: anyhow!(
5858 "Could not find a java package for version {}" ,
5959 java_version
6060 ) ) ?;
@@ -65,7 +65,7 @@ pub async fn install_java_from_major(java_version: u32) -> crate::Result<PathBuf
6565#[ onelauncher_macros:: memory]
6666pub async fn install_java_from_package ( download : JavaZuluPackage ) -> crate :: Result < PathBuf > {
6767 let state = State :: get ( ) . await ?;
68- let java_version = * download. java_version . get ( 0 ) . unwrap_or ( & 0 ) ;
68+ let java_version = * download. java_version . first ( ) . unwrap_or ( & 0 ) ;
6969
7070 let ingress = init_ingress (
7171 crate :: IngressType :: DownloadJava {
You can’t perform that action at this time.
0 commit comments