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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(conditional-formatting): close panel when switch subunit (#2828)
Gpound.liu6e772bc9fbc5
diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.tsxindex f1cdddd436..f893746893 100644--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.tsx+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-edit/index.tsx@@ -156,21 +156,19 @@ export const RuleEdit = (props: IRuleEditProps) => {useEffect(() => {// If the child table which the rule being edited is deleted, exit edit mode- if (props.rule?.cfId !== undefined) {- const disposable = commandService.onCommandExecuted((commandInfo) => {- if (commandInfo.id === RemoveSheetMutation.id) {- const params = commandInfo.params as IRemoveSheetMutationParams;- if (params.subUnitId === subUnitId && params.unitId === unitId) {- props.onCancel();- }- }- if (commandInfo.id === SetWorksheetActiveOperation.id) {+ const disposable = commandService.onCommandExecuted((commandInfo) => {+ if (commandInfo.id === RemoveSheetMutation.id) {+ const params = commandInfo.params as IRemoveSheetMutationParams;+ if (params.subUnitId === subUnitId && params.unitId === unitId) {props.onCancel();}- });- return () => disposable.dispose();- }- }, [props.rule?.cfId]);+ }+ if (commandInfo.id === SetWorksheetActiveOperation.id) {+ props.onCancel();+ }+ });+ return () => disposable.dispose();+ }, []);const onStyleChange = (config: unknown) => {result.current = config as Parameters<IStyleEditorProps['onChange']>;diff --git a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsx b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsxindex 319ea55283..c1f7a02ea9 100644--- a/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsx+++ b/packages/sheets-conditional-formatting-ui/src/components/panel/rule-list/index.tsx@@ -115,7 +115,7 @@ export const RuleList = (props: IRuleListProps) => {const localeService = useDependency(LocaleService);const conditionalFormattingI18nController = useDependency(ConditionalFormattingI18nController);- const workbook = useObservable(univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET))!;+ const workbook = useObservable(() => univerInstanceService.getCurrentTypeOfUnit$<Workbook>(UniverInstanceType.UNIVER_SHEET), undefined, undefined, [])!;const unitId = workbook.getUnitId();const worksheet = workbook.getActiveSheet();if (!worksheet) {