Skip to content

DevTools use the renderer version to detect features on react-reconciler #21262

@leops

Description

@leops

This is a followup issue for pmndrs/react-three-fiber#1231

From my understanding of this code, the DevTools parse the version number advertised by the renderer in injectIntoDevTools to select how to parse the internal fiber object. Unfortunately this means that third-party renderers that advertise a version lower than the equivalent React version for the react-reconciler release they are using get misclassified: for instance @react-three/fiber@6.0.13 is using react-reconciler@0.26.2 which is equivalent to react@17.0.2, and since major version 6.y.z is much lower than 17.y.z it uses the default values for the ReactTypeOfWork enum which in turns lead to FunctionComponent getting identified as IndeterminateComponent and hook inspection being unavailable.

A short term solution for renderers is to advertise a React-compatible version number, but ideally this is an implementation detail of the devtools that users of react-reconciler should not have to be aware of (also this means the version number displayed in the devtools is wrong). I'm not sure I'm familiar enough with the internals of the devtools to open a PR for this, but since the version parsing logic is used to detect features that are internal to react-reconciler anyway I guess a solution would be to have the Reconciler package add its own value for the ReactVersion constant along with the parameters sent to the devtools backend, and have the devtools use this string if its available over the renderer version.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions