react-xr icon indicating copy to clipboard operation
react-xr copied to clipboard

@iwer/devui depends on react 18, r3f latest need react 19

Open lewisdiamond opened this issue 8 months ago • 10 comments

Using xr with the latest versions of r3f brings in 2 versions of react and causes issues because devui depends on react 18. I suggest turning devui into an optional dependency given it's not essential.

lewisdiamond avatar Apr 13 '25 13:04 lewisdiamond

Could you elaborate on the issues you are referring to, if possible setting up a repo to reproduce them? All the examples in this repo run on react 19 while using the emulator and there were no issues :)

bbohlender avatar Apr 13 '25 13:04 bbohlender

I have ran into this issue as well.

geyang avatar Apr 16 '25 07:04 geyang

@geyang could you give more details on the exact issue? :)

bbohlender avatar Apr 16 '25 10:04 bbohlender

Not sure if this is what OP is referring to, but it seems even the latest version of "@react-three/xr" has a peer-dependency on react 18: https://github.com/pmndrs/xr/blob/a0e96785eaec02d5fb9651c198c263ff132ca4f1/packages/react/xr/package.json#L27

(Still investigating, but it appears this is causing my code-sandbox repo to pull in both react 18 and react 19.)

EDIT: Nevermind; Claude says that a peer-dependency of ">=18" would accept react 19 as well. Trying to figure out why v18 is getting included in my dependency tree on codesandbox then.

Venryx avatar Apr 16 '25 20:04 Venryx

>= means anythign beyond or equal 18 so its not a peer dependency on react 18, but a peer dependency on a react version equal or higher to 18, which includes 19

It pulls in both since iwer depends on it.

The part in question is what errors happens where and when :)

bbohlender avatar Apr 16 '25 20:04 bbohlender

Here is an example codesandbox that fails to load: https://codesandbox.io/p/sandbox/magical-drake-pplqf5?file=%2Fsrc%2FApp.tsx%3A11%2C18

Because iwer (I think) is trying to use react 18, whereas the app itself is using react 19.

I've been trying to find a way to force only react 19 to be installed (forcing iwer to use react 19, which seems to work in my full project, which uses yarn's "resolutions" to force only react 19), but I can't use that workaround in codesandbox since it doesn't support the "resolutions" field.

Venryx avatar Apr 16 '25 20:04 Venryx

its says "sandbox not found"

bbohlender avatar Apr 16 '25 20:04 bbohlender

Sorry, forgot to make it "Viewable with link". Should work now.

Venryx avatar Apr 16 '25 20:04 Venryx

thanks, I've forwarded it to the maintainer of iwer :)

bbohlender avatar Apr 16 '25 21:04 bbohlender

Sorry for bumping this, but I tried removing iwer from package-lock and I'm seeing more errors about internal usage of iwer for the emulation webui.

React 19 has changes in Suspense that are not compatible with <=18, causing various reference errors when loading a scene. I'm not sure if this will be fixed in the near future or if the only solution is to switch to a native js solution.

prnthh avatar Jun 27 '25 10:06 prnthh