Repository navigation
fix(web): make mobile sidebar auto-collapse idempotent - #9895
BiswasNehaa wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Explicit sidebar collapse apps/web/components/sidebar/sidebar-wrapper.tsx |
The resize effect explicitly collapses the sidebar on viewports narrower than 768 pixels when it is open. |
Estimated code review effort: 2 (Simple) | ~5 minutes
Change: Bug fix
Merge Risk: 
Minimal · up to 019c5
-
The narrow-viewport sidebar change is mergeable with no identified material risk.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title names the main change: the mobile sidebar auto-collapse effect is made idempotent. It follows the fix(web) convention, is one sentence, and matches the summary (toggleSidebar(true) replaces the flip). It is specific enough for a teammate scanning history to understand the primary change.
Full details: Description check
-
Explanation
The description is complete and relevant. It explains the sidebar bug, the cause, the fix, the affected behavior, the change type, the proposed test scenarios, and the related issue. It uses alternative headings for Summary and Test plan, and it does not include a separate References heading, but the required information is present.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
toggleSidebar() with no argument flips the current state. The auto-collapse effect in SidebarWrapper only re-runs on windowSize changes but also reads sidebarCollapsed from closure, so a second re-run with a stale value can flip the sidebar back open right after it collapsed. On narrow viewports the expanded sidebar is an absolute, full-height overlay, so this leaves it covering the board and swallowing every tap. Call toggleSidebar(true) instead so the effect sets the collapsed state explicitly and can't undo itself no matter how many times it re-fires. Fixes part of makeplane#9356.
55ef708 to
019c527
Compare
Summary
toggleSidebar()(a flip) instead oftoggleSidebar(true)(a set).windowSizechanges but also readssidebarCollapsedfrom closure (the exhaustive-deps lint rule is disabled on it), so a second re-run with a stale value can flip the sidebar back open right after it collapsed.absolute, full-height,z-20overlay on narrow viewports, this left it covering the board and swallowing every tap — reported as "tapping any kanban card does nothing" on iOS/WebKit.toggleSidebar(true)makes the effect idempotent: it can only ever assert "collapsed," so no number of stale re-fires can undo it.The other bug reported in #9356 (unguarded
window.requestIdleCallback) is already fixed upstream via therequestIdle/installIdleCallbackPolyfillwrapper inapps/web/lib/idle-task.ts, so this PR only addresses the sidebar overlay issue.Type of Change
Test plan
localhost:3000(soapp_sidebar_collapsedis unset, matching the "fresh visitor" condition in the issue)app_sidebar_collapsedin localStorage stays"true"Fixes part of #9356.
Summary by CodeRabbit