Skip to content

Commit 7c4ad10

Browse files
author
npub13n66s06epmqf2kc3v373ez8hj65cuzyvxzjf93vwpervxqn2u7jq2qd9je
committed
Merge remote-tracking branch 'origin/main' into fix/mobile-buzz-deep-links
* origin/main: fix(desktop): wait for terminal frame before splash (#4781) Signed-off-by: npub13n66s06epmqf2kc3v373ez8hj65cuzyvxzjf93vwpervxqn2u7jq2qd9je <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
2 parents 6075140 + 65f7a10 commit 7c4ad10

3 files changed

Lines changed: 54 additions & 3 deletions

File tree

‎desktop/src/features/terminal/TerminalBootstrap.test.mjs‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,56 @@ test("mounted bootstrap passes GUI context and ACKs only after consuming a frame
234234
);
235235
view.unmount();
236236
});
237+
238+
test("first-open splash waits for the first terminal frame", async () => {
239+
const { createElement } = await import("react");
240+
const { act, render, waitFor } = await import("@testing-library/react");
241+
const { ThemeProvider } = await import("@/shared/theme/ThemeProvider");
242+
const { TerminalBootstrap } = await import("./TerminalBootstrap.tsx");
243+
244+
const view = render(
245+
createElement(
246+
ThemeProvider,
247+
null,
248+
createElement(TerminalBootstrap, {
249+
channelId: "channel-1",
250+
channelName: "general",
251+
npub: "npub1owner",
252+
relayUrl: "wss://relay.example",
253+
threadId: null,
254+
}),
255+
),
256+
);
257+
await waitFor(() =>
258+
assert.ok(calls.some(({ command }) => command === "terminal_attach")),
259+
);
260+
assert.equal(
261+
view.container.querySelector(".buzz-terminal-welcome"),
262+
null,
263+
"the splash must not be consumed while the first PTY frame is pending",
264+
);
265+
266+
await act(async () => {
267+
emit({
268+
type: "frame",
269+
payload: {
270+
bracketedPaste: false,
271+
cursor: { column: 0, line: 0, visible: true },
272+
focusReporting: false,
273+
full: true,
274+
rows: [],
275+
sequence: 1,
276+
subscriptionId: "subscription-1",
277+
viewport: { columns: 100, generation: 0, screenLines: 24 },
278+
},
279+
});
280+
});
281+
await waitFor(() =>
282+
assert.ok(view.container.querySelector(".buzz-terminal-welcome")),
283+
);
284+
view.unmount();
285+
});
286+
237287
test("resize during in-flight catch-up keeps the newest viewport ready", async () => {
238288
const { createElement } = await import("react");
239289
const { act, render, waitFor } = await import("@testing-library/react");

‎desktop/src/features/terminal/TerminalBootstrap.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ export function TerminalBootstrap({
371371
focusReportingEnabled={active?.frame?.focusReporting ?? false}
372372
frame={active?.frame}
373373
viewportReportingEnabled={viewportReportingEnabled}
374-
showSplash={splashPending}
374+
showSplash={splashPending && Boolean(active?.frame)}
375375
onSplashStarted={handleSplashStarted}
376376
sessionFrames={channelSessions.flatMap((session) =>
377377
session.frame ? [{ sessionId: session.key, frame: session.frame }] : [],

‎desktop/src/features/terminal/TerminalSubstrate.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,9 @@ export function TerminalSubstrate({
345345
setWelcomeVisible(false);
346346
return;
347347
}
348-
if (!viewportReportingEnabled || !banner || !beginSplash()) return;
349-
}, [banner, viewportReportingEnabled, visible]);
348+
if (!showSplash || !viewportReportingEnabled || !banner || !beginSplash())
349+
return;
350+
}, [banner, showSplash, viewportReportingEnabled, visible]);
350351

351352
React.useEffect(() => {
352353
if (!welcomeVisible) return;

0 commit comments

Comments
 (0)