Skip the Skia web chart when a WebGL2 context can't be created#94937
Conversation
…ebgl-precheck # Conflicts: # src/components/HTMLEngineProvider/HTMLRenderers/VictoryChartRenderer/index.tsx
CanvasKit requests a webgl2 context whenever the WebGL2 API exists and never falls back to webgl1, throwing an uncatchable "failed to create webgl context" when it can't create one. Make the support probe request webgl2 the same way and treat an uncreatable context as unsupported, so SkiaWebChart shows its empty state instead of crashing. Removes the earlier standalone precheck it supersedes.
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@truph01 any ETA? thanks |
|
No product review needed. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-07-09.at.11.39.37.mov |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.33-0 🚀
|
|
🤖 No help site changes required. I reviewed the changes in this PR against the help site articles under Why: This is an internal crash-prevention fix. It hardens the WebGL2 capability probe in There's no new feature, no changed workflow, no new/renamed setting, tab, or button, and no change to any documented user-facing behavior. The Insights help articles (e.g. Since no changes are required, I did not create a draft docs PR. @wildan-m, if you believe a specific help article should be updated as a result of this change, let me know which one and I'll draft the update. |
Explanation of Change
On web, an uncaught
failed to create webgl context: err 0is reported to Sentry (APP-7MV) — 527 users and 6,337 events on/home. Charts render with Skia (CanvasKit), which requests a WebGL2 context and never falls back to WebGL1. When that context can't be created (hardware acceleration off, GPU blocklisted, or the per-page context limit exhausted), CanvasKit throws from its async draw loop — on arequestAnimationFrame/setTimeoutcallback that notry/catchor error boundary can catch.The shared chart wrapper already shows an "Unable to display chart" empty state when its WebGL probe fails, but the probe accepted a WebGL1 context (which CanvasKit won't use) and treated a missing context as supported, so this case slipped through. This makes the probe require WebGL2 the way CanvasKit does; the shader-precision check and capable clients are unchanged.
Fixed Issues
$ #93834
PROPOSAL: #93834 (comment)
Tests
The Sentry crash only reproduces on clients that can't create a WebGL2 rendering context (hardware acceleration disabled, GPU blocklisted, or the per-page context limit exhausted), so that condition is simulated from the console.
failed to create webgl context: err 0(or any other uncaught error) appears in the console. (Before this change, the same step throws that error from CanvasKit's asynchronous draw loop.)Platform scope: Steps 3–5 simulate the condition through the browser console, so they apply to MacOS: Chrome/Safari (desktop). On the other platforms the override can't be injected on-device, so just confirm there's no regression — the Spend over time, Top categories, and Top merchants charts still render normally:
mWeb (Android Chrome / iOS Safari): the fix is active here too (mWeb uses the same web chart wrapper); the override can only be injected via remote debugging.
iOS / Android Native: not affected — native charts render their
*ChartContentdirectly and never touchSkiaWebChart/CanvasKit.Verify that no errors appear in the JS console
Offline tests
This change does not affect offline behavior — the WebGL2 capability check and the chart rendering behave identically online and offline.
QA Steps
This change only hardens the WebGL-capability check that gates the web charts; the crash condition is environmental and can't be reliably forced on staging. Just confirm there's no regression around the charts on a WebGL-capable client:
The definitive result is only observable in production: once this deploys, the
APP-7MVSentry issue should stop receiving newfailed to create webgl contextevents.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
MacOS: Chrome / Safari
Kapture.2026-07-06.at.09.05.58.mp4
Android: mWeb Chrome
Kapture.2026-07-06.at.09.24.20.mp4
Android: Native
Kapture.2026-07-06.at.09.16.40.mp4
iOS: Native
Kapture.2026-07-06.at.09.11.01.mp4
iOS: mWeb Safari
Kapture.2026-07-06.at.09.09.28.mp4