Skip to content

Mitigate WebGL context loss due to canvas limits - #90

Merged
jernestmyers merged 2 commits into
mainfrom
mitigate-webgl-context-loss
Oct 22, 2026
Merged

jernestmyers merged 2 commits into
mainfrom
mitigate-webgl-context-loss

Conversation

@jernestmyers

@jernestmyers jernestmyers commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Aladin and the Plotly lightcurves use WebGL contexts when rendering their canvas. There is a finite limit to these contexts allowed by browsers, which means once the limit is exceeded, old contexts will silently be lost. Typically, this is a result of a user having several source pages open in different tabs, so returning to a tab with a lost context is especially confusing. For instance, the user that first noticed this issue was seeing blank lightcurves with still-working plot hovers.

This branch aims to mitigate this issue by:

  • minimizing the use of contexts in the first place via refactoring how the lightcurves are created, updated, and destroyed
  • listening to when a tab is "refocused" and, if necessary, refreshing the lightcurve's WebGL context automatically so it appears as expected
  • since Aladin's widget has some limitations/shortcomings that don't allow us to use the same hack as the lightcurves, instead we show an overlay explaining the context loss with a button that can refresh the Aladin instance; this applies to both the AllSkyMap on the main page and the source page's Aladin instance. (see screenshot for an example of the overlay)
image

Note that this issue seems less likely to surface on Firefox than on Chrome and Safari. I was unable to replicate the original bug on Firefox, even with 20-ish source pages open, but was able to do so on Chrome and Safari with just a few tabs open (after engaging with the lightcurve).

@jernestmyers
jernestmyers merged commit 6c0b283 into main Oct 22, 2026
1 check passed
@jernestmyers
jernestmyers deleted the mitigate-webgl-context-loss branch October 22, 2026 16:03
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