@@ -209,7 +209,7 @@ export class Menu<V> {
209209 * sometimes the items array is empty. The bug can be reproduced by switching this to use a
210210 * computed and then quickly opening and closing menus in the dev app.
211211 */
212- readonly items = ( ) => this . _items ( ) . map ( i => i . _pattern ) ;
212+ private readonly _itemPatterns = ( ) => this . _items ( ) . map ( i => i . _pattern ) ;
213213
214214 /** Whether the menu is visible. */
215215 readonly visible = computed ( ( ) => this . _pattern . visible ( ) ) ;
@@ -227,6 +227,7 @@ export class Menu<V> {
227227 this . _pattern = new MenuPattern ( {
228228 ...this ,
229229 parent : computed ( ( ) => this . parent ( ) ?. _pattern ) ,
230+ items : this . _itemPatterns ,
230231 multi : ( ) => false ,
231232 softDisabled : ( ) => true ,
232233 focusMode : ( ) => 'roving' ,
@@ -348,14 +349,15 @@ export class MenuBar<V> {
348349 readonly _pattern : MenuBarPattern < V > ;
349350
350351 /** The menu items as a writable signal. */
351- readonly items = signal < MenuItemPattern < V > [ ] > ( [ ] ) ;
352+ private readonly _itemPatterns = signal < MenuItemPattern < V > [ ] > ( [ ] ) ;
352353
353354 /** A callback function triggered when a menu item is selected. */
354355 onSelect = output < V > ( ) ;
355356
356357 constructor ( ) {
357358 this . _pattern = new MenuBarPattern ( {
358359 ...this ,
360+ items : this . _itemPatterns ,
359361 multi : ( ) => false ,
360362 softDisabled : ( ) => true ,
361363 focusMode : ( ) => 'roving' ,
@@ -367,7 +369,7 @@ export class MenuBar<V> {
367369 } ) ;
368370
369371 afterRenderEffect ( ( ) => {
370- this . items . set ( this . _items ( ) . map ( i => i . _pattern ) ) ;
372+ this . _itemPatterns . set ( this . _items ( ) . map ( i => i . _pattern ) ) ;
371373 } ) ;
372374
373375 afterRenderEffect ( ( ) => {
0 commit comments