Skip to content

refactor(ui-react): improve useSidebarLayout hook#6160

Closed
luizhf42 wants to merge 0 commit intomasterfrom
fix/ui-react/sidebar-mobile-desktop-transition
Closed

refactor(ui-react): improve useSidebarLayout hook#6160
luizhf42 wants to merge 0 commit intomasterfrom
fix/ui-react/sidebar-mobile-desktop-transition

Conversation

@luizhf42
Copy link
Copy Markdown
Member

@luizhf42 luizhf42 commented Apr 10, 2026

What

Improve the useSidebarLayout.ts hook and fix a mobile hamburger menu bug.

Why

That hook had a lot of unnecessary code, such as pathname tracking, useCallback and a buggy prevIsDesktop checking that broke the sidebar when resizing from mobile → desktop.

Testing

  • Go to the main React UI and ensure the sidebar works flawlessly in desktop and mobile.
  • On mobile, try to toggle (open/close) the sidebar clicking in the hamburger menu.
  • Resize the page from mobile to desktop and check if the sidebar goes from the hidden, opened by hamburger menu state, to the collapsed, open-on-hover state.
  • Make the same checks in the admin UI.

@luizhf42 luizhf42 requested a review from a team as a code owner April 10, 2026 14:51
@luizhf42 luizhf42 added kind/bug Something isn't working area/ui javascript Pull requests that update Javascript code labels Apr 10, 2026
@luizhf42 luizhf42 self-assigned this Apr 10, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

Claude finished @luizhf42's task in 3m 30s —— View job


Code Review Complete

Reviewed 1 file across code quality, security, testing, TypeScript patterns, and architecture — no blocking issues found. 1 inline comment posted (medium severity, optional suggestion).

The removal of the render-phase prevIsDesktop check is a clear net improvement — it fixes the reported bug where the sidebar would become permanently hidden on mobile→desktop transition. One optional suggestion was left inline about a minor stale-state edge case on resize round-trips, with a useEffect-based alternative if you want to handle it.


If you've addressed the feedback and want a new review, tag @shellhub-io/admin and a team member can trigger it.

@luizhf42 luizhf42 marked this pull request as draft April 10, 2026 15:06
@luizhf42 luizhf42 force-pushed the fix/ui-react/sidebar-mobile-desktop-transition branch from 3c69977 to 38bd238 Compare April 10, 2026 18:13
@luizhf42 luizhf42 changed the title fix(ui-react): remove buggy prevIsDesktop check refactor(ui-react): improve useSidebarLayout hook Apr 10, 2026
@luizhf42 luizhf42 marked this pull request as ready for review April 10, 2026 18:32
@gustavosbarreto
Copy link
Copy Markdown
Member

/review

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

Claude finished @gustavosbarreto's task in 3m 15s —— View job


Code Review Complete

Reviewed 3 files across code quality, security, testing, TypeScript patterns, and architecture — no new issues found. The code looks good as-is.

The stale expanded state edge case on resize round-trips was already discussed in the previous review thread and the author's decision to leave it is reasonable given the minimal UX impact and self-correcting behavior.


If you push additional changes and want a new review, tag @shellhub-io/admin and a team member can trigger it.

@luizhf42 luizhf42 force-pushed the fix/ui-react/sidebar-mobile-desktop-transition branch from 25abb68 to 7f376cd Compare April 13, 2026 18:47
@luizhf42 luizhf42 closed this Apr 13, 2026
@luizhf42 luizhf42 force-pushed the fix/ui-react/sidebar-mobile-desktop-transition branch from 7f376cd to 4a7f697 Compare April 13, 2026 18:48
@luizhf42 luizhf42 deleted the fix/ui-react/sidebar-mobile-desktop-transition branch April 13, 2026 18:49
@luizhf42
Copy link
Copy Markdown
Member Author

Closed because #6166 was merged and already included the commits from that branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ui javascript Pull requests that update Javascript code kind/bug Something isn't working kind/refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants