Skip to content

fix: throw WebGLUnsupportedError when WebGL is unavailable#141

Merged
dazzatronus merged 1 commit into
mainfrom
derk/webgl-load-error
Jul 15, 2026
Merged

fix: throw WebGLUnsupportedError when WebGL is unavailable#141
dazzatronus merged 1 commit into
mainfrom
derk/webgl-load-error

Conversation

@dazzatronus

Copy link
Copy Markdown
Contributor

What changed

  • Canvas.load() now throws a typed WebGLUnsupportedError (exported from the package root) when WebGL is unavailable, instead of resolving successfully. The in-canvas error overlay still renders before the throw, so integrations that don't catch keep the current visual behaviour.
  • Canvas.resize() is now a no-op when the renderer doesn't exist (before load() completes or after dispose()), instead of throwing TypeError: Cannot read properties of undefined (reading 'resize').

Why

When WebGL is unavailable (hardware acceleration disabled, some VMs/remote desktops), load() silently returned with no renderer. Hosts had no way to detect the failure, treated the editor as loaded, and any subsequent resize() call crashed. Hosts can now catch WebGLUnsupportedError and show their own error state.

Behaviour change

load() rejects where it previously resolved on WebGL-less browsers. Integrations that relied on the silent overlay are unaffected visually, but code awaiting load() should handle the rejection.

How to verify

npx jest tests/webgl-support.test.ts — jsdom has no WebGL, so the tests exercise the real failure path: load() rejects with WebGLUnsupportedError, the overlay still mounts, and resize() no-ops without a renderer.

@dazzatronus
dazzatronus merged commit 3344559 into main Jul 15, 2026
1 check passed
@dazzatronus
dazzatronus deleted the derk/webgl-load-error branch July 15, 2026 05:30
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.14.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant