You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat!: externalize sidebar toggle and remove navOpen state from the SDK (#3088)
### 🎯 Goal
The SDK currently couples itself to a specific layout pattern
(collapsible sidebar) by owning `navOpen` state in `ChatContext`. This
creates problems — e.g., the sidebar toggle renders even when no sidebar
exists — and prevents apps from fully controlling their own layout.
This PR removes all sidebar state management from the SDK and makes the
app fully responsible for sidebar visibility.
### 🛠 Implementation details
**Sidebar toggle externalized (commit 1-3):**
- Removed `ToggleSidebarButton` component from the SDK
- Added `SidebarToggle` slot to `ComponentContext` — apps provide their
own toggle via `WithComponents`
- All 4 headers (ChannelHeader, ChannelListHeader, ThreadHeader,
ThreadListHeader) render the slot when provided
- Removed `IconSidebar` (moved to vite example), `MenuIcon` prop,
`ToggleButtonIcon` prop
**navOpen state removed (commit 4):**
- Removed `navOpen`, `closeMobileNav`, `openMobileNav` from
`ChatContextValue`
- Removed `initialNavOpen` from `ChatProps`
- Removed `NAV_SIDEBAR_DESKTOP_BREAKPOINT` constant,
`useMobileNavigation` hook, `useIsMobileViewport` hook
- Removed auto-close-on-channel-selection (mobile) from
`setActiveChannel`
- Removed auto-close-on-thread-click from `ThreadListItemUI`
- Removed `openMobileNav` calls from `ChatViewSelector` buttons
- Removed all 7 navOpen-dependent CSS classes and their SCSS rules from
6 files
**Vite example updated:**
- New `SidebarContext` (`SidebarProvider` + `useSidebar`) replaces SDK
nav state
- `SidebarToggle` uses app-level sidebar state
- Layout panels read `sidebarOpen` from app context
- Resize handle toggles app-level sidebar state
- CSS rules hide the expand toggle when sidebar is visible (mutual
exclusivity)
### 🎨 UI Changes
No visual changes in the vite example — sidebar toggle behavior is
identical. Apps that don't provide a `SidebarToggle` will have no toggle
button in any header.
### ⚠️ Breaking changes
| Removed API | Migration |
|-------------|-----------|
| `ChatContextValue.navOpen` | Own your sidebar state |
| `ChatContextValue.closeMobileNav` / `openMobileNav` | Own your toggle
functions |
| `ChatProps.initialNavOpen` | Move to own state initializer |
| `NAV_SIDEBAR_DESKTOP_BREAKPOINT` | Define own constant |
| `useMobileNavigation` hook | Implement own click-outside logic |
| `ToggleSidebarButton` component | Provide `SidebarToggle` via
`WithComponents` |
| `MenuIcon` / `ToggleButtonIcon` props | Use `SidebarToggle` slot
instead |
| 7 navOpen CSS classes | Apply own classes from own state |
0 commit comments