Skip to content

fix(blocks): Globe block falls back when WebGL is unavailable - #510

Merged
lorant-one merged 2 commits into
previewfrom
fix/widgets-webgl-fallback
Nov 13, 2026
Merged

lorant-one merged 2 commits into
previewfrom
fix/widgets-webgl-fallback

Conversation

@lorant-one

Copy link
Copy Markdown
Member

Requested by Lorant · project thread

What

A user reported that docs.once-ui.com/blocks/widgets crashes in Firefox with "THREE.WebGLRenderer: Error creating WebGL context." The error takes down the whole page and shows the "Dang! It's broken" screen. The cause is the Globe1 block (react-globe.gl on three.js). When the browser can't create a WebGL context, three.js throws: hardware acceleration may be off, the GPU may be blocked, or the browser may be out of contexts. The filmstrip and the focus view each mount their own copy of the block.

  • Globe1 checks for WebGL before it loads react-globe.gl, and releases the test context right away. If there's no WebGL, it draws a flat outlined sphere instead. A small error boundary around the globe catches failures the check can't predict, such as running out of contexts or a GPU crash, and shows the same sphere. The fix lives in the block itself, so apps that copy the block get it too.
  • Blocks pages: a new BlockErrorBoundary wraps every preview, both the filmstrip thumbnails and the main preview. Any block that throws now shows "This preview can't run in this browser" inside its own frame, and the code and the rest of the page keep working.

Audit

  • packages/core MascotCube already catches renderer creation.
  • Studio's src/effects/* and the home die call getContext("webgl2") and handle null, which is how a raw context fails, so they're safe.
  • Studio's blocks pages render this same Globe1 from core at the commit pinned in blocks.source.json. They pick up the fix when that pin moves.

Checks

  • Docs typecheck is clean.
  • /blocks/widgets in Chromium with --disable-webgl --disable-3d-apis: the page renders, the Globe1 thumbnail shows the fallback sphere, and there are no page errors.
  • The same page with WebGL on: the globe still draws (one canvas).

Generated by Claude Code

docs.once-ui.com/blocks/widgets crashed in Firefox with "THREE.WebGLRenderer:
Error creating WebGL context": the globe threw and took the page down.
Globe1 now checks for WebGL before loading react-globe.gl, catches a
failure it could not predict, and draws a flat sphere instead. Every block
preview on the blocks pages also gets its own error boundary, so one
failing block can no longer break the page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016gNJtwQuhoLQdpygLCVEyk
@lorant-one lorant-one self-assigned this Nov 13, 2026

Copy link
Copy Markdown
Member Author

The visual check flagged two shots on /blocks/features (tiles 08 and 09). Those pages aren't touched by this PR. In the before (base) capture, the Features5 and Features6 preview images hadn't loaded yet. In the after capture, they had. Nothing in this diff changes how those blocks look: the error boundary renders its children untouched unless something throws.

The branch was also behind preview (#508 and #499 had landed since), so I merged preview in. That brings the base up to date and runs the check again.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

After the sync, the visual check flagged a different single shot: /data/setup, 149 px (0.06%). This PR doesn't touch that page. The diff only touches the blocks preview wrappers and the Globe block. Each run is flagging a different unrelated shot, which points to capture noise, so I've re-run the visual workflow once to confirm.


Generated by Claude Code

Copy link
Copy Markdown
Member Author

The re-run flagged the same shot again: /data/setup, 149 px. The before and after images are identical apart from the x-axis labels "1900", "1950" and "2025", which have moved by a pixel or two. Nothing on the data pages comes through this diff, which only touches apps/docs blocks components and the Globe block. preview hasn't moved since I merged it in, so the base is current. It looks like the chart's label measurement settles differently between builds, not something this PR caused.

I'm not adding visual-change myself to clear a check on a page this PR doesn't change. I've asked Lorant whether to accept it.


Generated by Claude Code

@lorant-one
lorant-one merged commit 745cbf1 into preview Nov 13, 2026
14 of 16 checks passed
@lorant-one lorant-one added the approved label Nov 13, 2026 — with Claude
@lorant-one
lorant-one deleted the fix/widgets-webgl-fallback branch November 15, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants