Skip to content

Commit ee46820

Browse files
committed
Revert "Fix: Default sidebar to open on desktop, use route param as override"
This reverts commit ab812f7.
1 parent ab812f7 commit ee46820

File tree

1 file changed

+8
-10
lines changed
  • packages/playground/website/src/lib/state/redux

1 file changed

+8
-10
lines changed

packages/playground/website/src/lib/state/redux/slice-ui.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,19 +128,16 @@ export interface UIState {
128128
const query = new URL(document.location.href).searchParams;
129129
const isEmbeddedInAnIframe = window.self !== window.top;
130130
// @TODO: Centralize these breakpoint sizes.
131+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
131132
const isMobile = window.innerWidth < 875;
132133

133134
// Parse the route parameter for sidebar/tab state
134135
const routeState = parseRouteParam(query.get('route'));
135-
const isSeamlessMode = query.get('mode') === 'seamless';
136136

137-
// Determine initial sidebar open state:
138-
// - If route param exists, use it (route=closed → closed, otherwise → open)
139-
// - If no route param, default to open on desktop, closed on mobile
140-
const hasExplicitRouteParam = query.has('route');
141-
const shouldSidebarBeOpen = hasExplicitRouteParam
142-
? routeState.sidebarOpen
143-
: !isMobile;
137+
// Check if there's an explicit route param requesting the sidebar to be open.
138+
// If so, respect it regardless of viewport size (but not in seamless mode or iframes).
139+
const hasExplicitRouteParam = query.has('route') && routeState.sidebarOpen;
140+
const isSeamlessMode = query.get('mode') === 'seamless';
144141

145142
const initialState: UIState = {
146143
/**
@@ -168,8 +165,9 @@ const initialState: UIState = {
168165
!isSeamlessMode &&
169166
// We do not expect to render the Playground app UI in an iframe.
170167
!isEmbeddedInAnIframe &&
171-
// Use explicit route param if provided, otherwise default based on viewport.
172-
shouldSidebarBeOpen,
168+
// If there's an explicit route param requesting sidebar open, respect it.
169+
// Otherwise default to closed on all viewport sizes.
170+
hasExplicitRouteParam,
173171
siteManagerSection: routeState.section,
174172
};
175173

0 commit comments

Comments
 (0)