[GH-ISSUE #148] requestAnimationFrame is broken #803

Closed
opened 2026-03-14 08:38:03 +03:00 by kerem · 2 comments
Owner

Originally created by @arv on GitHub (Sep 9, 2025).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/148

Originally assigned to: @msmps on GitHub.

Here is a minimal repro:

import { render } from "@opentui/react";
import { useEffect, useState } from "react";

// eslint-disable-next-line react-refresh/only-export-components
function App() {
  const [called, setCalled] = useState(false);

  useEffect(() => {
    requestAnimationFrame(() => {
      setCalled(true);
    });
  }, []);

  return <text>{called ? "Called" : "Not called"}</text>;
}

render(<App />);

When the app is first rendered the UI says Not called. If you force a render (by clicking or resizing the terminal) the callback gets called.

Originally created by @arv on GitHub (Sep 9, 2025). Original GitHub issue: https://github.com/anomalyco/opentui/issues/148 Originally assigned to: @msmps on GitHub. Here is a minimal repro: ```tsx import { render } from "@opentui/react"; import { useEffect, useState } from "react"; // eslint-disable-next-line react-refresh/only-export-components function App() { const [called, setCalled] = useState(false); useEffect(() => { requestAnimationFrame(() => { setCalled(true); }); }, []); return <text>{called ? "Called" : "Not called"}</text>; } render(<App />); ``` When the app is first rendered the UI says `Not called`. If you force a render (by clicking or resizing the terminal) the callback gets called.
kerem 2026-03-14 08:38:03 +03:00
Author
Owner

@msmps commented on GitHub (Sep 9, 2025):

Notes

<!-- gh-comment-id:3270520965 --> @msmps commented on GitHub (Sep 9, 2025): ## Notes - https://github.com/sst/opentui/blob/b1c33a0b2db8a7f458b3cc3d5f2dab17f5924188/packages/core/src/renderer.ts#L354-L367 - only runs callbacks on `loop` when `live` is true
Author
Owner

@msmps commented on GitHub (Sep 9, 2025):

fixed by #149

<!-- gh-comment-id:3271077024 --> @msmps commented on GitHub (Sep 9, 2025): fixed by #149
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#803
No description provided.