Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(glass): apply the glass attribute and fill before first paint
iceclatterWTa9304f53e1b2
diff --git a/src/renderer/App.tsx b/src/renderer/App.tsxindex a45b09437..5cd877e7f 100644--- a/src/renderer/App.tsx+++ b/src/renderer/App.tsx@@ -1,4 +1,4 @@-import { useEffect, useState } from 'react'+import { useEffect, useLayoutEffect, useState } from 'react'import { ReactFlowProvider } from '@xyflow/react'import { Canvas } from './canvas/Canvas'import { PromptDialogHost } from './components/promptDialog'@@ -71,8 +71,12 @@ export default function App() {// Publish the resolved appearance as `data-theme` on <html> — what the light palette in// styles.css keys off. Absent, or 'dark', leaves every token at its original value, so this one// attribute is all that stands between an existing install and the chrome it has always had.+ // Layout effects, like the two glass effects below: all three land before the browser paints, so+ // switching Liquid Glass on never shows one frame of `data-nt-glass` without its fill (transparent+ // chrome), and a theme switch never paints the old theme's fill. The setGlassChrome in the first+ // glass effect re-renders synchronously, still before paint.const appTheme = useAppTheme()- useEffect(() => {+ useLayoutEffect(() => {document.documentElement.dataset.theme = appTheme}, [appTheme])@@ -97,7 +101,7 @@ export default function App() {rgb?: readonly number[]readable: number | null} | null>(null)- useEffect(() => {+ useLayoutEffect(() => {const root = document.documentElementif (!liquidGlass) {delete root.dataset.ntGlass@@ -114,7 +118,7 @@ export default function App() {root.dataset.ntGlass = 'on'}, [liquidGlass, appTheme])// The slider (and the accessibility overrides) only ever set custom properties.- useEffect(() => {+ useLayoutEffect(() => {const root = document.documentElementif (!glassChrome) {root.style.removeProperty('--glass-chrome-bg')diff --git a/src/renderer/lib/glassContrast.test.ts b/src/renderer/lib/glassContrast.test.tsindex 184637e60..a29ce8460 100644--- a/src/renderer/lib/glassContrast.test.ts+++ b/src/renderer/lib/glassContrast.test.ts@@ -243,6 +243,16 @@ describe('Keep blur while moving', () => {})})+it('App applies data-theme and the glass attribute + fill before paint (no transparent first frame)', () => {+ const src = readFileSync(join(__dirname, '..', 'App.tsx'), 'utf8')+ for (const marker of ['document.documentElement.dataset.theme = appTheme', "root.dataset.ntGlass = 'on'", "root.style.setProperty(\n '--glass-chrome-bg'"]) {+ const at = src.indexOf(marker)+ expect(at, marker).toBeGreaterThan(0)+ const before = src.slice(0, at)+ expect(before.lastIndexOf('useLayoutEffect('), marker).toBeGreaterThan(before.lastIndexOf('useEffect('))+ }+})+describe('glass status chip keeps its label readable', () => {const rows = TERMINAL_THEMES.map((t) => {const readable = glassTintAlpha(t.theme.foreground!, t.theme.background!)