Skip to content

fix(viewer): kick render on focus and visibility resume#439

Open
Aymericr wants to merge 1 commit into
mainfrom
fix/viewer-kick-on-resume
Open

fix(viewer): kick render on focus and visibility resume#439
Aymericr wants to merge 1 commit into
mainfrom
fix/viewer-kick-on-resume

Conversation

@Aymericr

@Aymericr Aymericr commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Lands #291 (@mvanhorn) onto current main. The original PR was correct but conflicted on surrounding comments; this is the same fix rebased clean.

With frameloop="never" the rAF loop is the only render driver. Browsers throttle requestAnimationFrame when the tab is hidden/unfocused/occluded, freezing the canvas (viewer appears to 'turn off' between interactions). Adds visibilitychange/focus/pageshow listeners that force one synchronous advance() on resume, with matching cleanup. Deps unchanged.

Typecheck + lint pass. Co-authored with @mvanhorn. Fixes #275, closes #196.


Note

Low Risk
Small, localized viewer render-loop change with proper listener cleanup; no auth, data, or API surface changes.

Overview
Fixes a frozen canvas when the tab is hidden, unfocused, or occluded while FrameLimiter runs with frameloop="never" (rAF is the only render driver).

Adds a kick() helper that bumps the internal clock and calls advance() once synchronously. visibilitychange (when state becomes visible), window focus, and pageshow invoke it so the first frame after resume reflects current scene state. The effect cleanup removes those listeners alongside the existing rAF cancel and frameloop restore.

Reviewed by Cursor Bugbot for commit 7dada9c. Bugbot is set up for automated code reviews on this repo. Configure here.

With frameloop="never" the rAF loop is the only render driver. Browsers
throttle requestAnimationFrame when the tab is hidden/unfocused/occluded, which
freezes the canvas (the viewer appears to 'turn off' between interactions on
Linux Firefox/Chrome/Zen). Add visibilitychange/focus/pageshow listeners that
force one synchronous advance() on resume, with matching cleanup.

Lands #291 (mvanhorn) onto current main (resolves the comment-context conflict).
Fixes #275. Closes #196.

Co-authored-by: mvanhorn <[email protected]>
@mintlify

mintlify Bot commented Jun 24, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
pascal 🔴 Failed Jun 24, 2026, 8:03 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The view is not displaying properly(mac os) Screen repaint issue

2 participants