INJIWEB-1640 Fix mobile sidebar default open state after login#509
INJIWEB-1640 Fix mobile sidebar default open state after login#509iamlokanath wants to merge 1 commit intoinji:developfrom
Conversation
Signed-off-by: Lkanath Panda <lokanathpanda128@gmail.com>
WalkthroughThe Sidebar component now intelligently initializes its collapsed state based on viewport width. A mobile breakpoint constant (640px) and initialization function were added, with SSR-safe fallback handling to determine the initial sidebar state during page load. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Rudhhi-Shah-14
left a comment
There was a problem hiding this comment.
Also let's add the unit tests for the same please
| const MOBILE_BREAKPOINT_PX = 640; // Matches Tailwind 'sm' – below this is mobile | ||
|
|
||
| function getInitialSidebarCollapsed(): boolean { | ||
| if (typeof window === 'undefined') return false; | ||
| return window.innerWidth < MOBILE_BREAKPOINT_PX; | ||
| } | ||
|
|
There was a problem hiding this comment.
as this is purely responsive behaviour, we could avoid the JS breakpoint check and handle the initial collapsed or expanded state using Tailwind’s sm: classes.
I would suggest giving that approach a try please
Rudhhi-Shah-14
left a comment
There was a problem hiding this comment.
Do add the unit tests for the changes



Initialize the sidebar collapsed on mobile viewports so that, after login,
users land on the home screen with the sidebar closed by default, while
keeping the existing behavior (open by default) on larger screens.
INJIWEB-1640.mp4
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.