Repository navigation
perf(a11y): pause WebGL and mascot decorative motion while hidden - #8438
AmirrezaFarnamTaheri wants to merge 17 commits into
Conversation
|
Warning Review limit reached
This review includes 9 billable files and costs up to $2.25. Or wait 50 seconds for your next included review. View limit details
Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): perf(a11y): pause WebGL and mascot decorative motion while hidden. This pull request pauses decorative animation work while the page is hidden or the user prefers reduced motion. It introduces a shared activity hook and threads it through the WebGL tetrahedron canvas, the mascot idle-pose rotation, and the mascot clock, with colocated tests. Review snapshot
Completeness: Complete What changedAdds a shared `useAnimationActivity` subscription based on `useSyncExternalStore` over document visibility and `prefers-reduced-motion` (app/src/hooks/useAnimationActivity.ts). Uses it to stop the WebGL render loop while keeping a static frame and retained scene in RotatingTetrahedronCanvas.tsx. Gates the mascot idle-pose scheduler in RiveMascot.tsx and accumulates active elapsed time in useMascotClock.ts so the clock does not jump or reset on resume. Adds tests for the hook, clock, RiveMascot idle rotation, ManifestRiveMascot, and the tetrahedron canvas. Features
TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6666312d03
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| setPoseRef.current = setPose; | ||
| useEffect(() => { | ||
| if (!idlePoseRotation || basePose !== 'idle') return; | ||
| if (!idlePoseRotation || !animationAllowed || basePose !== 'idle') return; |
There was a problem hiding this comment.
Apply the activity guard to manifest mascots
When a user has selected a manifest mascot, HumanPage renders ManifestRiveMascot instead of this component, so the new guard is bypassed as soon as its buffer loads. ManifestRiveStage still starts its idle-flourish timeout at ManifestRiveMascot.tsx:150-170, and ChannelDriver still starts auto-cycle intervals at lines 223-237, with no visibility or motion check. Those custom mascots therefore continue changing pose/channel while the document is hidden or prefers-reduced-motion is enabled; propagate animationAllowed to that stage and its channel drivers rather than guarding only the bundled path.
Useful? React with 👍 / 👎.
Summary
Problem
Decorative WebGL loops and mascot idle/clock animation could run while a page was hidden or the user requested reduced motion. Besides needless work, clocks can jump on resumption and idle timer changes can produce extra background animation.
Solution
Use
useAnimationActivitybased onuseSyncExternalStorewith document visibility andprefers-reduced-motionchange subscriptions, then gate only decorative RAF/timers. Keep WebGL resources mounted, draw a stable frame while paused, and accumulate active elapsed time instead of including hidden duration. Keep business processing, model streaming and functional UI unaffected.Submission Checklist
useAnimationActivity.test.tsx,useMascotClock.test.tsx,RiveMascot.test.tsx: document hidden and reduced-motion toggles, frame/timer cleanup, pause/resume continuity, and no extra idle poses.## Related: 4.3.7 (Mascot Avatar Animation) and 4.3.4 (Subagent Mascot Visualization); decorative-only behavior change.Closes #NNN: N/A — no confirmed tracking issue to close; no invented issue reference.Impact
Frontend desktop/web performance and accessibility. Less background CPU/GPU work and no unnecessary motion; visible active animation retains existing appearance. No backend, vendor, inference, or network behavior change.
Related
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
AmirrezaFarnamTaheri:upstream/perf-pause-hidden-decorative-motion-202610276666312d03bf599f09e360a69714731c8be751f8Validation Run
6666312d03bf599f09e360a69714731c8be751f8.pnpm --filter openhuman-app exec vitest run src/hooks/useAnimationActivity.test.tsx src/features/human/Mascot/useMascotClock.test.tsx src/features/human/Mascot/RiveMascot.test.tsxis included in the hosted Vitest suite (not run locally).Validation Blocked
Behavior Changes
Parity Contract
useAnimationActivitybased onuseSyncExternalStorewith document visibility andprefers-reduced-motionchange subscriptions, then gate only decorative RAF/timers.useAnimationActivity.test.tsx,useMascotClock.test.tsx,RiveMascot.test.tsx: document hidden and reduced-motion toggles, frame/timer cleanup, pause/resume continuity, and no extra idle poses.Duplicate / Superseded PR Handling
Review readiness (2026-10-28)
6666312d03bf.