Skip to content

Commit 784dc07

Browse files
authored
fix: fix panels didn't active the next one after closing automatically (#653)
1 parent 2294b3d commit 784dc07

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/components/tabs/tab.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ export function Tab({ tab, active, ...restEvents }: ITabComponent) {
156156
tabItemClassName,
157157
status ? 'status' : 'op'
158158
)}
159-
onClick={() => onCloseTab?.(id)}
159+
onClick={(e) => {
160+
e.stopPropagation();
161+
onCloseTab?.(id);
162+
}}
160163
renderStatus={(isHover) => renderStatus(status, isHover)}
161164
/>
162165
)}

src/components/tabs/tabExtra.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getBEMElement } from 'mo/common/className';
33

44
interface ITabExtraProps {
55
classNames?: string;
6-
onClick?: () => void;
6+
onClick?: React.MouseEventHandler<HTMLDivElement>;
77
renderStatus?: (hover: boolean) => JSX.Element;
88
}
99

src/controller/panel.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,8 @@ export class PanelController extends Controller implements IPanelController {
6666
}
6767

6868
public readonly onTabChange = (key: UniqueId): void => {
69-
const state = this.panelService.getState();
7069
if (key) {
71-
this.panelService.setState({
72-
current: state.data?.find((item) => item.id === key),
73-
});
70+
this.panelService.setActive(key);
7471
}
7572
this.emit(PanelEvent.onTabChange, key);
7673
};

0 commit comments

Comments
 (0)