Skip to content

Degrade gracefully when WebGL2 is unavailable#26

Open
kixelated wants to merge 1 commit into
mainfrom
claude/vibrant-lamarr-bb7cb9
Open

Degrade gracefully when WebGL2 is unavailable#26
kixelated wants to merge 1 commit into
mainfrom
claude/vibrant-lamarr-bb7cb9

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

What

Stops the app from rendering a blank page when the browser has WebGL disabled.

Why

On browsers/configs that disable WebGL (e.g. Librewolf's per-domain allow list, or privacy extensions that block WebGL to prevent fingerprinting), the entire site rendered a blank page. The cause: new Canvas() runs during the synchronous SolidJS render, and GLContext threw WebGL2 not supported when getContext("webgl2") returned null. That exception aborted the whole render — even the landing/info pages that don't need WebGL at all — leaving only a console error:

Uncaught Error: WebGL2 not supported

How

The animated GL background is purely decorative and used on every page, while the room genuinely needs WebGL for video rendering. So the handling is split:

  • app/src/room/canvas.tsCanvas now wraps WebGL context creation in try/catch, exposes a readonly supported flag, and guards every GL operation (resize, render loop, #render, cleanup). When WebGL is unavailable the app runs fine, just without the animated background. The gl/glContext/camera getters still throw if accessed while unsupported, but the room is gated so they're never reached in that state.
  • app/src/sup.tsx — the room's App (which drives WebGL video) is wrapped in <Show when={props.canvas.supported}> with a new WebGLUnsupported notice as fallback, explaining that WebGL must be enabled and the page reloaded.

Result

  • Marketing/info pages render normally (minus the animated background) with WebGL disabled.
  • Opening a room shows a clear "WebGL is required" message instead of a blank page + console crash.
  • Allowing WebGL for the site and reloading restores full functionality.

Notes for reviewer

  • tsc --noEmit and biome check pass on the changed files.
  • Not verified live in a WebGL-disabled browser yet.

🤖 Generated with Claude Code

The whole app rendered a blank page on browsers/configs that disable
WebGL (e.g. Librewolf's per-domain allow list). new Canvas() ran during
the synchronous SolidJS render and GLContext threw "WebGL2 not supported"
when getContext("webgl2") returned null, aborting the entire render —
even pages that don't need WebGL.

Canvas now catches the failure, exposes a `supported` flag, and guards
all GL operations so the decorative background simply doesn't render.
The room (which needs WebGL for video) is gated behind canvas.supported
and shows a clear "WebGL is required" notice instead of a blank page.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kixelated, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1c69fedb-10b4-4b6d-8154-44b7fb87d9cb

📥 Commits

Reviewing files that changed from the base of the PR and between 1a8d7b5 and e96b41f.

📒 Files selected for processing (2)
  • app/src/room/canvas.ts
  • app/src/sup.tsx
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/vibrant-lamarr-bb7cb9

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@kixelated kixelated enabled auto-merge (squash) June 29, 2026 20:12
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.

1 participant