feat: support sidebar=collapsed query param for embedded launches - #712
Open
almendio-dev wants to merge 1 commit into
Open
feat: support sidebar=collapsed query param for embedded launches#712almendio-dev wants to merge 1 commit into
almendio-dev wants to merge 1 commit into
Conversation
Adds an opt-in sidebar=collapsed query parameter that opens the app with the session sidebar collapsed on desktop. All other values are ignored and keep the current default (sidebar open). - lib/initial-navigation.ts: parses the param alongside the existing cwd / session params - components/AppShell.tsx: initial sidebarOpen state respects the flag on first render only; no persistence, no settings entry Embedders (e.g. launching pi-web in an iframe from a project launcher) want the chat to be the primary surface on open. Today the sidebar always starts expanded on desktop and there is no supported way to change that from the launching URL. Mobile behavior is unchanged: the sidebar still auto-collapses once the breakpoint resolves. The top-bar toggle works exactly as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an opt-in
sidebar=collapsedquery parameter that opens the app withthe session sidebar collapsed on desktop. All other values are ignored and
keep the current default (sidebar open).
lib/initial-navigation.ts: parses the param alongside the existingcwd/sessionparamscomponents/AppShell.tsx: initialsidebarOpenstate respects the flagon first render only; no persistence, no settings entry
Why
Embedders (e.g. launching pi-web in an iframe from Spinup Dev Portal)
want the chat to be the primary surface on open. Today the sidebar always
starts expanded on desktop and there is no supported way to change that
from the launching URL.
Behavior
/or/?session=xor/?cwd=x/?sidebar=collapsed/?cwd=x&sidebar=collapsed/?session=x&sidebar=collapsed/?sidebar=anything-elseMobile behavior is unchanged: the sidebar still auto-collapses once the
breakpoint resolves. The top-bar toggle works exactly as before in both
states.
For embedders:
sidebar=collapsedcontains only URL-safe characters, soit survives both plain string concatenation and
URLSearchParams-basedURL building. The app reads it with
searchParams.get(), which decodesone round of standard percent-encoding; only double-encoding the param
into another param's value would break detection.
Testing
node --testunit tests forgetInitialNavigationcovering all casesabove plus a URL-encoded value; the four pre-existing assertions gained
sidebarCollapsed: false(strictdeepEqual)tsc --noEmitcleannpm run lint: 15 errors, all pre-existing on main, none in changedfiles
next buildintentionally not run locally per project convention(pollutes
.next/during dev); typecheck covers the change surface/?sidebar=collapsedloads with the sidebar closed and the top-bar toggle re-expands it;
loading without the param or with
sidebar=bogusis unchanged