I'm using glslCanvas within a react app and am failing to cleanly destroy the instance.
It appears the render loop does not get aborted so causes an error after the destruction?
My hook looks like this:
// Spawn the glsl canvas
useEffect(() => {
if (!webGlSupported && GlslCanvas) return;
sandbox.current = new GlslCanvas(canvas.current);
return () => {
sandbox.current.pause();
sandbox.current.destroy();
};
}, [webGlSupported]);
This causes an error:
Uncaught TypeError: Cannot read property 'canvas' of null
at GlslCanvas.resize (GlslCanvas.es.js:1394)
at RenderLoop (GlslCanvas.es.js:1084)
I'm using
glslCanvas
within a react app and am failing to cleanlydestroy
the instance. It appears the render loop does not get aborted so causes an error after the destruction?My hook looks like this:
This causes an error:
Related: #8