File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,9 +50,14 @@ export const Menu: React.FC<MenuProps> & {
5050 const handleSubmenuOpen = ( ) => setHasActiveSubmenu ( true ) ;
5151 const handleSubmenuClose = ( ) => setHasActiveSubmenu ( false ) ;
5252
53+ // Guard: don't open menu with no children (prevents PaperMenu layout hang)
54+ const effectiveVisible =
55+ menuProps . visible && React . Children . toArray ( children ) . length > 0 ;
56+
5357 return (
5458 < PaperMenu
5559 { ...menuProps }
60+ visible = { effectiveVisible }
5661 style = { [
5762 styles . menu ,
5863 hasActiveSubmenu && styles . menuWithSubmenu ,
Original file line number Diff line number Diff line change 10281028 "benchmark" : {
10291029 "title" : " Benchmark" ,
10301030 "modelSelector" : {
1031- "prompt" : " Select Model"
1031+ "prompt" : " Select Model" ,
1032+ "noModels" : " No models downloaded"
10321033 },
10331034 "buttons" : {
10341035 "advancedSettings" : " Advanced Settings" ,
Original file line number Diff line number Diff line change @@ -312,16 +312,24 @@ export const BenchmarkScreen: React.FC = observer(() => {
312312 l10n . benchmark . modelSelector . prompt }
313313 </ Button >
314314 } >
315- { modelStore . availableModels . map ( model => (
315+ { modelStore . availableModels . length === 0 ? (
316316 < Menu . Item
317- key = { model . id }
318- onPress = { ( ) => handleModelSelect ( model ) }
319- label = { model . name }
320- leadingIcon = {
321- model . id === modelStore . activeModelId ? 'check' : undefined
322- }
317+ key = "no-models"
318+ label = { l10n . benchmark . modelSelector . noModels }
319+ disabled
323320 />
324- ) ) }
321+ ) : (
322+ modelStore . availableModels . map ( model => (
323+ < Menu . Item
324+ key = { model . id }
325+ onPress = { ( ) => handleModelSelect ( model ) }
326+ label = { model . name }
327+ leadingIcon = {
328+ model . id === modelStore . activeModelId ? 'check' : undefined
329+ }
330+ />
331+ ) )
332+ ) }
325333 </ Menu >
326334 ) ;
327335
Original file line number Diff line number Diff line change @@ -96,6 +96,22 @@ describe('BenchmarkScreen', () => {
9696 } ) ;
9797 } ) ;
9898
99+ it ( 'should show placeholder when no models are available' , ( ) => {
100+ const originalModels = modelStore . models ;
101+ modelStore . models = [ ] ;
102+
103+ const { getByText} = render ( < BenchmarkScreen /> ) ;
104+
105+ // Open model selector
106+ fireEvent . press ( getByText ( 'Select Model' ) ) ;
107+
108+ // Verify placeholder is shown
109+ expect ( getByText ( 'No models downloaded' ) ) . toBeDefined ( ) ;
110+
111+ // Restore
112+ modelStore . models = originalModels ;
113+ } ) ;
114+
99115 it ( 'should initialize model when selected' , async ( ) => {
100116 const { getByText} = render ( < BenchmarkScreen /> ) ;
101117 const modelToSelect = modelStore . availableModels [ 0 ] ;
You can’t perform that action at this time.
0 commit comments