Skip to content

fix: nullish coalescing in sidebar collapse logic#622

Open
ishanloya wants to merge 1 commit intofrappe:mainfrom
ishanloya:patch-1
Open

fix: nullish coalescing in sidebar collapse logic#622
ishanloya wants to merge 1 commit intofrappe:mainfrom
ishanloya:patch-1

Conversation

@ishanloya
Copy link
Copy Markdown

@ishanloya ishanloya commented Apr 16, 2026

When the || operator is used, isMobile.value is always true on mobile so the Sidebar is always collapsed on mobile.

Summary by CodeRabbit

  • Bug Fixes
    • Improved sidebar collapse behavior on mobile devices by refining state fallback logic. The sidebar now correctly defaults to mobile detection when the collapse state is undefined, ensuring consistent behavior across different device types and scenarios.

When the || operator is used, isMobile.value is always true on mobile so the Sidebar is always collapsed on mobile.
@ishanloya ishanloya changed the title Fix nullish coalescing in sidebar collapse logic fix: nullish coalescing in sidebar collapse logic Apr 16, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d16605a7-6969-4886-8155-fded24b8789e

📥 Commits

Reviewing files that changed from the base of the PR and between 32ba273 and b4793f3.

📒 Files selected for processing (1)
  • src/components/Sidebar/Sidebar.vue

Walkthrough

Updated the collapse state computation in the Sidebar component to use nullish-coalescing operator instead of logical OR. The shouldCollapse computed property now evaluates as (isCollapsed.value ?? isMobile.value) rather than (isCollapsed.value || isMobile.value). This changes behavior when isCollapsed.value is null, causing it to defer to isMobile.value in that case. Boolean values (true/false) maintain their existing behavior. The change does not modify exported APIs or other control flow logic.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix nullish coalescing in sidebar collapse logic' directly and accurately describes the main change: replacing the || operator with ?? (nullish coalescing) in the shouldCollapse computed logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant