Bug: Crash with combination of webgl and React.StrictMode
I came across a likely bug that happens when a pixi.js / pixi-react 8 project unloads and reloads a pixi application, causing a crash.
This crash only seems to occur when React.StrictMode and webgl are used, and potentially other factors.
Here's a codesandbox demonstrating the crash with some additional info: https://codesandbox.io/p/sandbox/ltv7cc
Just toggle the checkbox multiple times to unload and reload the pixi application, which should cause the crash.
I see this crash on an M1 MacBook Pro and Chrome browser. Safari also has problems, but instead of showing the crash icon, toggling the checkbox twice just results in an empty blue rectangle (no text content is rendered in the app).
Delaying the initialization by a frame on a RAF callback throws an error that may give us more insight into the core issue...
Example: https://codesandbox.io/p/sandbox/pixi-react-vite-test-forked-slw69l
logProgramError.mjs:15 Uncaught TypeError: Cannot read properties of null (reading 'split')
at logPrettyShaderError (logProgramError.mjs:15:47)
at logProgramError (logProgramError.mjs:41:7)
at generateProgram (generateProgram.mjs:38:48)
at GlShaderSystem._createProgramData (GlShaderSystem.mjs:88:69)
at GlShaderSystem._getProgramData (GlShaderSystem.mjs:84:56)
at GlShaderSystem._setProgram (GlShaderSystem.mjs:80:30)
at GlShaderSystem.bind (GlShaderSystem.mjs:38:10)
at GlBatchAdaptor.start (GlBatchAdaptor.mjs:30:21)
at _BatcherPipe.execute (BatcherPipe.mjs:72:21)
at executeInstructions (executeInstructions.mjs:19:40)
at RenderGroupSystem.render (RenderGroupSystem.mjs:34:24)
at SystemRunner.emit (SystemRunner.mjs:22:21)
at WebGLRenderer.render (AbstractRenderer.mjs:91:25)
at _Application.render (Application.mjs:36:19)
at TickerListener.emit (TickerListener.mjs:30:18)
at _Ticker.update (Ticker.mjs:156:29)
at _tick (Ticker.mjs:34:14)
Can confirm, this is also happening to me. It seems to be getting stuck in an infinite loop inside checkMaxIfStatementsInShader for me, and hanging the entire page.
I've been working on a massive upgrade on my project and now I'm remembering this crash bug is in there and is a big blocker for me. Can this issue be looked at again, or are there workarounds to try? I thought that StrictMode was a factor, but I am not using it in this project and the crash happens when the Pixi application is unloaded and then loaded again with webgl.
Thanks very much @thejustinwalsh or whoever else might be able to help!