Skip to content

Conversation

@sergioisidoro
Copy link

@sergioisidoro sergioisidoro commented Dec 8, 2025

I've been struggling with being stuck at Pixi js <8.12 due to an application lifecycle issue. This only happens on >8.13. I think they stem from these changes in batching -- pixijs/pixijs#10885 & pixijs/pixijs#11581

The app renders correctly on first render, but when I navigate to a non Pixi view on the react app, and back to the pixi application, I'm greeted with a pixi crash:

Uncaught TypeError: Cannot read properties of undefined (reading 'destroy')
    at GpuBufferSystem.onBufferChange (GpuBufferSystem.ts:107:19)
    at Buffer.emit (index.js:181:35)
    at Buffer.setDataWithSize (Buffer.ts:276:22)
    at _GraphicsContextSystem2._initContextRenderData (GraphicsContextSystem.ts:252:30)
    at _GraphicsContextSystem2.getContextRenderData (GraphicsContextSystem.ts:152:67)
    at GpuGraphicsAdaptor.execute (GpuGraphicsAdaptor.ts:78:27)
    at GraphicsPipe.execute (GraphicsPipe.ts:153:23)
    at executeInstructions (executeInstructions.ts:19:91)
    at RenderGroupPipe._executeDirect (RenderGroupPipe.ts:136:29)
    at RenderGroupPipe.execute (RenderGroupPipe.ts:58:18)

I've added some comments in this issue pixijs/pixijs#11694, thinking this was an unsafe handling of the GPU Batches: I still feel that this kind of crash is not very graceful. But perhaps this is something we need to fix here also.

#625 reported that this happens only or React Strict, but it can also happen on navigation back and forth to the pixi application.

I've played around with the releaseGlobalResources and removeView, but only setting them both to true seems to work. It would be nice to prevet full destruction of the application between navigation events tho.

@trezy
Copy link
Collaborator

trezy commented Dec 21, 2025

I think this change carries too much risk for applications currently using PixiJS React and would require a major version bump. As an alternative, I suggest making these options configurable via props on the <Application> component.

I don't have time to build and test this atm, but it would require something like this:

As long as the values default to false as they do in Pixi, you should be able to pull the RendererDestroyOptions and DestroyOptions types from pixi.js, which will simplify the work. Otherwise it's just making sure the types are correct and the tests still pass. Bonus points if you add a couple tests to verify that these new options are working as expected.

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.

2 participants