Skip to content

Commit 99a2905

Browse files
committed
fix(FR-820): compact sidebar doesn't work when refreshing. (#3495)
resolves #3340, #3496 ([FR-820](https://lablup.atlassian.net/browse/FR-820)) ## Remove redundant `onCollapse` handler in MainLayout to keep sidebar collapse after refreshing This PR removes the redundant `onCollapse` handler from the MainLayout component. The handler was setting the `sideCollapsed` state, which is already being handled by the existing `onBreakpoint` function. ### Minimum requirements to check during review - wide screen - [ ] if compact sidebar is true, keep compact sidebar after refreshing. - [ ] if compact sidebar is false, sidebar always expanded. - middle screen - [ ] always compact sidebar - narrow screen - [ ] always hidden sidebar **Checklist:** - [ ] Documentation - [ ] Minium required manager version - [x] Specific setting for review (eg., KB link, endpoint or how to setup) - [x] Minimum requirements to check during review: toggle `Use Compact Sidebar by default` in usersettings page. - [ ] Test case(s) to demonstrate the difference of before/after [FR-820]: https://lablup.atlassian.net/browse/FR-820?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 44ee94f commit 99a2905

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

react/src/components/MainLayout/MainLayout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ function MainLayout() {
162162
!compactSidebarActive && setSideCollapsed(false);
163163
}
164164
}}
165-
onCollapse={(collapsed) => {
166-
setSideCollapsed(collapsed);
165+
onCollapse={(collapsed, type) => {
166+
type === 'clickTrigger' && setSideCollapsed(collapsed);
167167
}}
168168
webuiplugins={webUIPlugins}
169169
/>

react/src/components/MainLayout/WebUISider.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@ type MenuItem = {
5656
key: string;
5757
};
5858
interface WebUISiderProps
59-
extends Pick<BAISiderProps, 'collapsed' | 'collapsedWidth' | 'onBreakpoint'> {
59+
extends Pick<
60+
BAISiderProps,
61+
'collapsed' | 'collapsedWidth' | 'onBreakpoint' | 'onCollapse'
62+
> {
6063
webuiplugins?: WebUIPluginType;
61-
onCollapse?: (collapsed: boolean) => void;
6264
}
6365

6466
type GroupName =
@@ -443,7 +445,7 @@ const WebUISider: React.FC<WebUISiderProps> = (props) => {
443445
buttonTop={68}
444446
// buttonTop={18}
445447
onClick={(collapsed) => {
446-
props.onCollapse?.(collapsed);
448+
props.onCollapse?.(collapsed, 'clickTrigger');
447449
}}
448450
hidden={!gridBreakpoint.sm || !isSiderHover}
449451
/>

0 commit comments

Comments
 (0)