Cesium WebGL Contexts Error

So I'm currently working on an application including Cesium. I have a page that generates and removes views as certain data objects are selected. However, despite using .destroy on the views and verifying that they are destroyed (by using isDestroyed() which is returning true), I am continuing to have an error that "Too many active WebGL contexts. Oldest context will be lost." Upon clicking again, it blows up my application.

I am not sure what to do at this point. For a reference of what I am saying, someone shared their code snippet on the sandcastle, and I am able to recreate the error by adding and deleting their view over and over (around 21ish times). Attached the sandcastle link for reference. Is there any way to fully destroy/have cesium viewers let go of the WebGL to actually remove or is this a bug? Thanks in advance.

sandcastle link mentioned above.

Looks like there is already an issue for this:


It looks like this might be an issue with how the browser frees up memory. I suggested that perhaps Cesium can allow users to re-use WebGL contexts. In the mean time you might try to dig into the source and do this yourself (and if you get it to work we’d absolutely appreciate a contribution!)

Or perhaps you can destroy all entities and hide/re-use the viewer as a workaround?