Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix: fix issue where custom menu items are hidden by default when `hidden$` is not configured (#3122)

白熱701131d4e035
diff --git a/packages/ui/src/components/menu/desktop/Menu.tsx b/packages/ui/src/components/menu/desktop/Menu.tsx
index 78602ad882..e80cd819db 100644
--- a/packages/ui/src/components/menu/desktop/Menu.tsx
+++ b/packages/ui/src/components/menu/desktop/Menu.tsx
@@ -25,7 +25,7 @@ import {
import { CheckMarkSingle, MoreSingle } from '@univerjs/icons';
import clsx from 'clsx';
import React, { useMemo, useState } from 'react';
-import { combineLatest, isObservable, map } from 'rxjs';
+import { combineLatest, isObservable, map, Observable } from 'rxjs';
import type {
IDisplayMenuItem,
@@ -91,7 +91,7 @@ function MenuWrapper(props: IBaseMenuProps) {
const filteredGroup: Record<string, IDisplayMenuItem<IMenuItem>[]> = {};
Object.entries(group).forEach(([key, items]) => {
- const hiddenObservables = items.map((item) => item.hidden$).filter((item) => !!item);
+ const hiddenObservables = items.map((item) => item.hidden$ ?? new Observable<boolean>((subscriber) => subscriber.next(false)));
combineLatest(hiddenObservables)
.pipe(