pixijs / pixi-react

Write PIXI apps using React declarative style
https://pixijs.io/pixi-react/
MIT License
2.42k stars 180 forks source link

Bug: `__REACT_PIXI_REQUEST_RENDER__` event is not emitted when expected #469

Closed avpeery closed 7 months ago

avpeery commented 10 months ago

Current Behavior

I have a project that includes a toggle behavior to render a container component. When I initially render the component, it renders as expected. When I toggle off rendering the container, the __REACT_PIXI_REQUEST_RENDER__ event is emitted and it does not render the container as expected. However, when I attempt to toggle the container to render back on __REACT_PIXI_REQUEST_RENDER__ is not emitted despite running through the code path as expected.

As a work around, I have a useEffect on the parent component set up to run app.stage.emit('__REACT_PIXI_REQUEST_RENDER__') when toggle is turned back on.

Expected Behavior

I expect __REACT_PIXI_REQUEST_RENDER__ event to emit whenever a component changes, including toggling back on the rendering of the container.

Steps to Reproduce

Haven't been able to reproduce on a minimal reproduction of the issue but does seem to be a bug with pixi/react. Will continue to see if I can get a codesandbox reproduction. raf should be set as false on the app.stage options and renderOnComponentChange should be set to true. I think it is mainly reproducible with toggling a graphics component in a child of a container in a pixi stage.

Environment

Possible Solution

No response

Additional Information

No response

avpeery commented 10 months ago

Maybe related to #408