* Sets the terminal tab title, with an animated prefix glyph while a query * is running. Isolated from REPL so the 960ms animation tick re-renders only * this leaf component (which returns null — pure side-effect) instead of the * entire REPL tree. Before extraction, the tick was ~1 REPL render/s
(t0)
| 482 | * the duration of every turn, dragging PromptInput and friends along. |
| 483 | */ |
| 484 | function AnimatedTerminalTitle(t0) { |
| 485 | const $ = _c(6); |
| 486 | const { |
| 487 | isAnimating, |
| 488 | title, |
| 489 | disabled, |
| 490 | noPrefix |
| 491 | } = t0; |
| 492 | const terminalFocused = useTerminalFocus(); |
| 493 | const [frame, setFrame] = useState(0); |
| 494 | let t1; |
| 495 | let t2; |
| 496 | if ($[0] !== disabled || $[1] !== isAnimating || $[2] !== noPrefix || $[3] !== terminalFocused) { |
| 497 | t1 = () => { |
| 498 | if (disabled || noPrefix || !isAnimating || !terminalFocused) { |
| 499 | return; |
| 500 | } |
| 501 | const interval = setInterval(_temp2, TITLE_ANIMATION_INTERVAL_MS, setFrame); |
| 502 | return () => clearInterval(interval); |
| 503 | }; |
| 504 | t2 = [disabled, noPrefix, isAnimating, terminalFocused]; |
| 505 | $[0] = disabled; |
| 506 | $[1] = isAnimating; |
| 507 | $[2] = noPrefix; |
| 508 | $[3] = terminalFocused; |
| 509 | $[4] = t1; |
| 510 | $[5] = t2; |
| 511 | } else { |
| 512 | t1 = $[4]; |
| 513 | t2 = $[5]; |
| 514 | } |
| 515 | useEffect(t1, t2); |
| 516 | const prefix = isAnimating ? TITLE_ANIMATION_FRAMES[frame] ?? TITLE_STATIC_PREFIX : TITLE_STATIC_PREFIX; |
| 517 | useTerminalTitle(disabled ? null : noPrefix ? title : `${prefix} ${title}`); |
| 518 | return null; |
| 519 | } |
| 520 | function _temp2(setFrame_0) { |
| 521 | return setFrame_0(_temp); |
| 522 | } |
nothing calls this directly
no test coverage detected