My own mistakeL-07QFAI
Calling loseContext() in a WebGL effect's cleanup breaks the remount on the same canvas in React's dev mode
- What happened
- in development React runs every effect twice: run, clean up, run. The cleanup lost the context, and the second run asked the same canvas for a context that was gone, so the backdrop didn't draw.
- The fix
- the cleanup frees what the effect made (the buffer and the program) and keeps the context, so the same canvas can mount again.
Velvet Sidebar — Glass Collapsible Navigation Sidebar for React · Ramin Valadan ·