codeant-ai-for-open-source[bot] commented on code in PR #37298:
URL: https://github.com/apache/superset/pull/37298#discussion_r2710427073
##########
superset-frontend/src/SqlLab/components/AppLayout/index.tsx:
##########
@@ -99,47 +139,59 @@ const AppLayout: React.FC = ({ children }) => {
return (
<StyledContainer>
- <Splitter
- css={css`
- flex: 1;
- `}
- lazy
- onResizeEnd={onSidebarChange}
- onResize={noop}
- >
- <Splitter.Panel
- collapsible={{
- start: true,
- end: true,
- showCollapsibleIcon: true,
- }}
- size={leftWidth}
- min={SQL_EDITOR_LEFTBAR_WIDTH}
+ <StyledSidebarWrapper>
+ <Layout.Sider
+ collapsed
Review Comment:
**Suggestion:** Logic bug: `Layout.Sider` is hard-coded to be collapsed
because the `collapsed` prop is provided without a value (equivalent to true).
This forces the sidebar to always render in its collapsed state and never
expand; toggle/resize logic will not make it expand. Make `collapsed`
controlled by `leftWidth` so the Sider collapses/expands according to state.
[logic error]
<details>
<summary><b>Severity Level:</b> Critical 🚨</summary>
```mdx
- ❌ SQL Lab left sidebar cannot expand (AppLayout component).
- ⚠️ Database explorer toggle click has no visible effect.
```
</details>
```suggestion
collapsed={leftWidth <= SQL_EDITOR_LEFTBAR_COLLAPSED_WIDTH}
```
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Open the SQL Lab UI which mounts AppLayout (component defined in
superset-frontend/src/SqlLab/components/AppLayout/index.tsx). The AppLayout
render begins
at the return block where the sidebar is declared (see Layout.Sider at lines
143-146 of
the PR diff).
2. Inspect toggle logic: toggleSidebar useCallback is declared earlier in
the same file
(toggleSidebar at line 96 in the PR hunk) and sets leftWidth to
SQL_EDITOR_LEFTBAR_WIDTH
when expanding (line 98), and to SQL_EDITOR_LEFTBAR_COLLAPSED_WIDTH when
collapsing (line
100).
3. Interact with the collapsed menu: the collapsed Menu is rendered inside
the Sider
(StyledMenu at lines 147-151). Clicking the menu item calls toggleSidebar
(collapsedMenuItems definition at lines 104-115 which uses toggleSidebar).
4. Observe behavior: despite toggleSidebar updating leftWidth, Layout.Sider
is hard-coded
with the boolean prop collapsed (see lines 143-146). Because collapsed is
always true, the
Sider remains visually collapsed and never expands even after toggleSidebar
executes —
reproducing the bug (click collapsed menu item, sidebar does not expand).
```
</details>
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/SqlLab/components/AppLayout/index.tsx
**Line:** 144:144
**Comment:**
*Logic Error: Logic bug: `Layout.Sider` is hard-coded to be collapsed
because the `collapsed` prop is provided without a value (equivalent to true).
This forces the sidebar to always render in its collapsed state and never
expand; toggle/resize logic will not make it expand. Make `collapsed`
controlled by `leftWidth` so the Sider collapses/expands according to state.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]