Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Render loop redraws on every animation frame, even when nothing changed or the terminal is hidden

Open
#208 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
performance

Research direction

Start with Terminal.startRenderLoop() and compare its behavior with the xterm.js render service mentioned in the issue. Check how writes, resizing, scrolling, selection, hover, focus, cursor blinking, and element visibility should trigger rendering. Done means unchanged or hidden terminals do not redraw every frame, and a terminal renders again when it becomes visible.

Written by the indexing model from the issue text.

Description

Version: ghostty-web 0.4.0 (npm latest)

What happens
Terminal.startRenderLoop() schedules requestAnimationFrame on every frame for as long as the terminal is open, and calls renderer.render() each time. It does this when nothing has changed, and also when the terminal's element is hidden (display: none) or off screen. A page that keeps a terminal mounted in the background, as the Pterodactyl panel 2.0 does so that the console survives tab switches, keeps paying for it on every other page.

Measured in Chromium with 4x CPU throttling on a page that keeps a hidden 170x57 terminal mounted while it receives about 10 lines of output per second: about 1.1 s of long animation frames per 6 s attributed to ghostty-web's frame callback, and roughly 25% fewer frames than the same page without the terminal. Unmounting the terminal removed both.

Suggestion

  • Render only when something changed: a write, a resize, scrolling, selection, hover, focus, or the cursor blink. The blink can run on its own timer at its blink rate, not at 60 Hz.
  • Pause rendering while the terminal's element is not visible, for example with an IntersectionObserver on the element, and render once when it becomes visible again. xterm.js does this in its render service.

Related: #198 (at a fractional devicePixelRatio the same loop also resizes and repaints the whole terminal on every frame).

Dominant language
TypeScript
Stars
3k
Forks
193
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from coder/ghostty-web

All issues in coder/ghostty-web

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.