@@ -22,22 +22,30 @@ const InstallationMethodDropdown: FC = () => {
2222 [ release . os , release . version ]
2323 ) ;
2424
25+ const enabledInstallMethods = useMemo (
26+ ( ) => parsedInstallMethods . filter ( ( { disabled } ) => ! disabled ) ,
27+ [ parsedInstallMethods ]
28+ ) ;
29+
2530 // We group Platforms on the Platform Dropdown to provide the User
2631 // understanding of what is recommended/official and what is not.
2732 const grouppedMethods = useMemo (
28- ( ) => [
29- {
30- label : t ( 'layouts.download.dropdown.platformGroups.official' ) ,
31- items : parsedInstallMethods . filter ( ( { recommended } ) => recommended ) ,
32- } ,
33- {
34- label : t ( 'layouts.download.dropdown.platformGroups.unofficial' ) ,
35- items : parsedInstallMethods . filter ( ( { recommended } ) => ! recommended ) ,
36- } ,
37- ] ,
33+ ( ) =>
34+ [
35+ {
36+ label : t ( 'layouts.download.dropdown.platformGroups.official' ) ,
37+ items : enabledInstallMethods . filter ( ( { recommended } ) => recommended ) ,
38+ } ,
39+ {
40+ label : t ( 'layouts.download.dropdown.platformGroups.unofficial' ) ,
41+ items : enabledInstallMethods . filter (
42+ ( { recommended } ) => ! recommended
43+ ) ,
44+ } ,
45+ ] . filter ( ( { items } ) => items . length > 0 ) ,
3846 // We only want to react on the change of the parsedPlatforms
3947 // eslint-disable-next-line react-hooks/exhaustive-deps
40- [ parsedInstallMethods ]
48+ [ enabledInstallMethods ]
4149 ) ;
4250
4351 useEffect ( ( ) => {
@@ -49,28 +57,28 @@ const InstallationMethodDropdown: FC = () => {
4957 // Sets either the utmost recommended platform or the first non-disabled one
5058 // Note that the first item of groupped platforms is always the recommended one
5159 nextItem < InstallationMethod | '' > ( '' , grouppedMethods [ 0 ] . items ) ||
52- nextItem < InstallationMethod | '' > ( '' , parsedInstallMethods ) ;
60+ nextItem < InstallationMethod | '' > ( '' , enabledInstallMethods ) ;
5361
5462 // This will never return an empty string as there should always be an item
5563 // when the OS has finished loading for a given installation method
5664 release . setInstallMethod ( installationMethod as InstallationMethod ) ;
5765 }
5866 // eslint-disable-next-line react-hooks/exhaustive-deps
59- } , [ parsedInstallMethods , release . installMethod , release . os ] ) ;
67+ } , [ enabledInstallMethods , release . installMethod , release . os ] ) ;
6068
6169 // We set the Platform to the next available platform when the current
6270 // one is not valid anymore due to OS or Version changes
6371 useEffect (
6472 ( ) => {
6573 if ( release . os !== 'LOADING' && release . installMethod !== '' ) {
6674 release . setInstallMethod (
67- nextItem ( release . installMethod , parsedInstallMethods )
75+ nextItem ( release . installMethod , enabledInstallMethods )
6876 ) ;
6977 }
7078 } ,
7179 // We only want to react on the change of the OS and Version
7280 // eslint-disable-next-line react-hooks/exhaustive-deps
73- [ release . os , release . version ]
81+ [ enabledInstallMethods , release . os , release . version ]
7482 ) ;
7583
7684 return (
0 commit comments