Skip to content

fix(desktop): make v2 right sidebar toggle reactive#3421

Merged
saddlepaddle merged 1 commit into
mainfrom
left-sidebar-icon
Apr 13, 2026
Merged

fix(desktop): make v2 right sidebar toggle reactive#3421
saddlepaddle merged 1 commit into
mainfrom
left-sidebar-icon

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented Apr 13, 2026

Summary

  • The v2 right sidebar toggle's hover icon swap (LuPanelRightLuPanelRightOpen/LuPanelRightClose) was silently broken: isOpen was read via a one-shot collections.v2WorkspaceLocalState.get(workspaceId) call, so the component never re-rendered when rightSidebarOpen changed.
  • Switched to useLiveQuery (matching useV2WorkspacePaneLayout) so the toggle reactively reflects the current state, and the hover icon now matches the left sidebar toggle's behavior.

Test plan

  • Open a v2 workspace, confirm right sidebar toggle icon swaps on hover when sidebar is closed (shows open-arrow) vs open (shows close-arrow)
  • Toggle via hotkey (⌘L) and confirm the top-bar icon updates without needing a remount

Summary by cubic

Make the v2 right sidebar toggle reactive so the hover icon reflects the current open state. Replaced a one-off state read with a live query tied to v2WorkspaceLocalState.

  • Bug Fixes
    • Switched to useLiveQuery from @tanstack/react-db with eq from @tanstack/db to subscribe to per-workspace v2WorkspaceLocalState.
    • Hover icon now correctly shows open/close state and updates on hotkey toggle (⌘L), matching the left sidebar behavior.

Written for commit 94efc23. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • The right sidebar open/closed state now updates in real-time as database state changes, replacing previous locally-cached state handling to ensure consistent sidebar behavior throughout the application.

The hover icon swap was silently broken because isOpen was read via a
one-shot collections.get() call instead of a live query, so the component
never re-rendered when rightSidebarOpen changed.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7f5a1f85-c649-403a-8ccc-380296e5d2ed

📥 Commits

Reviewing files that changed from the base of the PR and between 039edf2 and 94efc23.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/RightSidebarToggle/RightSidebarToggle.tsx

📝 Walkthrough

Walkthrough

Replaced synchronous local state lookup in the RightSidebarToggle component with a reactive useLiveQuery database query. The sidebar state is now derived from live database rows filtered by workspace ID rather than being accessed from an in-memory cache, enabling real-time updates.

Changes

Cohort / File(s) Summary
RightSidebarToggle State Management
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/RightSidebarToggle/RightSidebarToggle.tsx
Migrated from synchronous collections.v2WorkspaceLocalState.get(workspaceId) to reactive useLiveQuery with workspaceId filtering; isOpen now derived from first matching database row with fallback to false.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 From sync to live, the state takes flight,
No more stale data holding tight,
The query dances, fresh and free,
Sidebar opens reactively! ✨
Real-time magic, oh what a sight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: making the v2 right sidebar toggle reactive.
Description check ✅ Passed The description includes a detailed summary, test plan, and context but is missing some template sections like Related Issues and Type of Change selection.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch left-sidebar-icon

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.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 13, 2026

Greptile Summary

This PR fixes a reactivity bug in the RightSidebarToggle component where isOpen was read via a one-shot collections.v2WorkspaceLocalState.get(workspaceId) call, so the component never re-rendered when rightSidebarOpen changed externally (e.g., via the ⌘L hotkey). The fix switches to useLiveQuery, which subscribes to changes and triggers re-renders correctly.

  • Replaced one-shot .get(workspaceId) with useLiveQuery matching the exact pattern used in useV2WorkspacePaneLayout.ts
  • Added eq from @tanstack/db and useLiveQuery from @tanstack/react-db — the same imports already used by the neighbouring hook
  • The localStateRows[0]?.rightSidebarOpen ?? false default preserves the existing fallback behavior

Confidence Score: 5/5

Safe to merge — the change is a one-file, targeted bug fix that adopts the codebase's established reactive pattern.

The fix is minimal and correct: it replaces a non-reactive read with useLiveQuery using the exact same query shape, imports, and dependency array already proven in useV2WorkspacePaneLayout.ts. The fallback default ?? false is preserved, and the rest of the component (toggle action, icon logic, tooltip) is unchanged. No new patterns are introduced and no regressions are expected.

No files require special attention.

Important Files Changed

Filename Overview
apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/RightSidebarToggle/RightSidebarToggle.tsx Replaces one-shot .get() with useLiveQuery so isOpen reactively updates; directly mirrors the established pattern in useV2WorkspacePaneLayout.ts.

Sequence Diagram

sequenceDiagram
    participant Hotkey as ⌘L Hotkey
    participant Toggle as RightSidebarToggle
    participant Collection as v2WorkspaceLocalState
    participant LiveQuery as useLiveQuery

    Note over Toggle,LiveQuery: Before fix — one-shot read
    Toggle->>Collection: .get(workspaceId)
    Collection-->>Toggle: snapshot (stale, no re-render on change)
    Hotkey->>Collection: .update(workspaceId, draft)
    Note over Toggle: Toggle never re-renders — icon stays stale

    Note over Toggle,LiveQuery: After fix — reactive subscription
    LiveQuery->>Collection: subscribe query (workspaceId)
    Collection-->>Toggle: live rows (triggers re-render on any change)
    Hotkey->>Collection: .update(workspaceId, draft)
    Collection-->>LiveQuery: row changed
    LiveQuery-->>Toggle: re-render with updated isOpen
Loading

Reviews (1): Last reviewed commit: "fix(desktop): make v2 right sidebar togg..." | Re-trigger Greptile

@saddlepaddle saddlepaddle merged commit b18a00c into main Apr 13, 2026
7 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

MocA-Love pushed a commit to MocA-Love/superset that referenced this pull request Apr 14, 2026
…perset-sh#3421)

The hover icon swap was silently broken because isOpen was read via a
one-shot collections.get() call instead of a live query, so the component
never re-rendered when rightSidebarOpen changed.
MocA-Love pushed a commit to MocA-Love/superset that referenced this pull request Apr 14, 2026
All 9 upstream commits have been individually cherry-picked via PR#159~#163:

| Upstream | Our PR | Description |
|---|---|---|
| d656b7e (superset-sh#3415) | #159 (PR#1) | terminal clipboard handling |
| 31fcf19 (superset-sh#3416) | #162 (PR#4) | v1 split pane startup sizing fix |
| 039edf2 (superset-sh#3403) | #161 (PR#3) | Cmd+Alt+Arrow spatial pane focus |
| b18a00c (superset-sh#3421) | #159 (PR#1) | v2 right sidebar toggle reactive |
| 3dd1de2 (superset-sh#3420) | #161 (PR#3) | v2 diff viewer + tab title resolution |
| b42a114 (superset-sh#3418) | #159 (PR#1) | CodeMirror hotkey enablement |
| c925f4d (superset-sh#3422) | #160 (PR#2) | unbound defaults + restore prev/next tab/workspace |
| bb12c09 (superset-sh#3419) | #163 (PR#5) | version bump 1.5.3 |
| 47efa73 (superset-sh#3432) | #159 (PR#1) | pending/update-required error selectable |

Fork-specific features preserved:
- auto-updater (IS_FORK, GitHub Releases API)
- QuitMode/cleanupMainWindowResources lifecycle
- GitHubSyncService, SpreadsheetViewer
- BROWSER_RELOAD / BROWSER_HARD_RELOAD / SEARCH_IN_FILES hotkeys
- HotkeyCategory "Browser"
- v1 deep-link navigation (useSearch/WorkspaceSearchParams)
- v1 tRPC-based PREV/NEXT_WORKSPACE handlers
- v1 CLOSE_TERMINAL/CLOSE_TAB hotkey handlers
- v2 extra state (rightSidebarOpenViewWidth, showPresetsBar)
@Kitenite Kitenite deleted the left-sidebar-icon branch May 6, 2026 04:53
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