Skip to content

7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.

TypeScript

fix(client): keep the Playground scroll inside its transcript pane (#1037)

Nadhir Halbouni0ee2b0cdeaa8
diff --git a/README.md b/README.md
index 3fa45309..3a5b4d8d 100644
--- a/README.md
+++ b/README.md
@@ -470,6 +470,7 @@ Contributors very welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for the dev lo
<a href="https://github.com/hiiamwaffledev"><img src="https://images.weserv.nl/?url=github.com/hiiamwaffledev.png&w=40&h=40&fit=cover&mask=circle" width="40" alt="@hiiamwaffledev" /></a>
<a href="https://github.com/w0fv1"><img src="https://images.weserv.nl/?url=github.com/w0fv1.png&w=40&h=40&fit=cover&mask=circle" width="40" alt="@w0fv1" /></a>
<a href="https://github.com/oppih"><img src="https://images.weserv.nl/?url=github.com/oppih.png&w=40&h=40&fit=cover&mask=circle" width="40" alt="@oppih" /></a>
+<a href="https://github.com/n3dhir"><img src="https://images.weserv.nl/?url=github.com/n3dhir.png&w=40&h=40&fit=cover&mask=circle" width="40" alt="@n3dhir" /></a>
## Disclaimer
diff --git a/client/src/App.test.ts b/client/src/App.test.ts
new file mode 100644
index 00000000..b4b375e3
--- /dev/null
+++ b/client/src/App.test.ts
@@ -0,0 +1,38 @@
+import { readFileSync } from 'node:fs'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { describe, expect, it } from 'vitest'
+
+// The Playground only scrolls inside its transcript pane if every ancestor
+// between <body> and that pane carries a definite height. One unconditional
+// `min-h-screen` on the shell breaks it: min-height is a floor, not a ceiling,
+// so the shell grows with the chat and the document scrolls instead. The
+// contract lives in a couple of class strings in App.tsx
+// and regresses silently, so it is pinned here like the chain manager pins
+// its routing.
+const here = path.dirname(fileURLToPath(import.meta.url))
+const app = readFileSync(path.join(here, 'App.tsx'), 'utf8')
+const playground = readFileSync(path.join(here, 'pages/PlaygroundPage.tsx'), 'utf8')
+
+describe('app shell heights', () => {
+ it('pins full-bleed routes to the viewport, padded routes to the document', () => {
+ // h-dvh gives the shell a definite height so the flex chain below can
+ // constrain the transcript; overflow-hidden stops the document itself
+ // from scrolling. Padded routes keep plain min-height and scroll as a
+ // document — clipping them under h-dvh would leave long pages with no
+ // scrollbar at all.
+ expect(app).toMatch(/fullBleed \? 'h-dvh overflow-hidden' : 'min-h-screen'/)
+ })
+
+ it('passes a definite height down the flex chain to the page', () => {
+ // Dropping min-h-0/flex-1 anywhere between the shell and the page lets
+ // the content size its ancestors again, which is the original bug by
+ // another route.
+ expect(app).toContain("'flex min-h-0 flex-1 flex-col'")
+ expect(playground).toContain('flex min-h-0 flex-1 overflow-hidden')
+ })
+
+ it('keeps /playground in the full-bleed set', () => {
+ expect(app).toMatch(/FULL_BLEED_ROUTES = new Set\(\[[^\]]*'\/playground'[^\]]*\]\)/)
+ })
+})
diff --git a/client/src/App.tsx b/client/src/App.tsx
index 8e0b1131..92b698b0 100644
--- a/client/src/App.tsx
+++ b/client/src/App.tsx
@@ -405,6 +405,21 @@ function PageContainer({ children }: { children: ReactNode }) {
)
}
+// The shell column. Padded routes keep `min-h-screen` and scroll as a document;
+// a full-bleed route pins the shell to the dynamic viewport instead, because
+// min-height alone is a floor, not a ceiling: with an indefinite shell height
+// every flex-1 container below grows with its content and the document scrolls
+// rather than the one pane (the Playground transcript) that means to.
+function AppShell({ children }: { children: ReactNode }) {
+ const location = useLocation()
+ const fullBleed = FULL_BLEED_ROUTES.has(location.pathname)
+ return (
+ <div className={`flex flex-col ${fullBleed ? 'h-dvh overflow-hidden' : 'min-h-screen'} ${isDesktopApp ? 'desktop-backdrop' : 'bg-background'}`}>
+ {children}
+ </div>
+ )
+}
+
function App() {
return (
<QueryClientProvider client={queryClient}>
@@ -416,7 +431,7 @@ function App() {
leaves without anyone having to know how tall the navbar is.
Fixed-position children (toaster, palette, reminder) are out of
flow, and a padded route stretches to nothing it can show. */}
- <div className={`flex min-h-screen flex-col ${isDesktopApp ? 'desktop-backdrop' : 'bg-background'}`}>
+ <AppShell>
<Navbar />
<PageContainer>
<PageBoundary>
@@ -451,7 +466,7 @@ function App() {
<Toaster />
<CommandPalette />
<UpdateReminder />
- </div>
+ </AppShell>
</AuthGate>
</BrowserRouter>
</I18nProvider>