michalochman / react-pixi-fiber

Write PixiJS applications using React declarative style.
MIT License
858 stars 94 forks source link

Explicit "createStageClass" usage causes crash #332

Closed J00nz closed 9 months ago

J00nz commented 9 months ago

Description

Trying to use "createStageClass" results in crash.

Getting the following error once I try to run: Uncaught TypeError: Cannot read properties of undefined (reading 'alternate') at getNearestMountedFiber (react-pixi-fiber.development.js:2542:1) at isFiberMounted (react-pixi-fiber.development.js:2576:1) at findCurrentUnmaskedContext (react-pixi-fiber.development.js:3679:1) at getContextForSubtree (react-pixi-fiber.development.js:20261:1) at Object.updateContainer (react-pixi-fiber.development.js:20380:1) at render (react-pixi-fiber.development.js:21480:1) at renderApp (react-pixi-fiber.development.js:21615:1) at renderStage (react-pixi-fiber.development.js:21624:1) at Stage.renderStage$1 (react-pixi-fiber.development.js:21897:1) at Stage.componentDidMount (react-pixi-fiber.development.js:21801:1)

From my investigation, it seems like it happens due to "getContextForSubtree" runs "get(parentComponent)", which returns null.

Steps to reproduce

  1. Import "createStageClass" instead of "Stage".
  2. Try running the application

Additional info

michalochman commented 9 months ago

Hey @J00nz, I can confirm that we lost compatibility with React 16 after updating react-reconciler in the react-pixi-fiber@1.0.0 release. Due to how this library is structured currently, it will be impossible to make it compatible again with React 16 without a major rewrite of the reconcile code. The last version working with React 16 is react-pixi-fiber@0.14.3.

Looking at the changelog, since you're using PixiJS 5, there have been no bug fixes since then that would be relevant to your use case.