DevTools use the renderer version to detect features on react-reconciler #21262
Description
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/[email protected] is using [email protected] which is equivalent to [email protected], 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.
Activity
bvaughn commentedon Apr 14, 2021
Once #21268 and #21269 land (and get released) newer versions of the reconciler will inject its own version (to be used instead of the renderer version). Unfortunately this won't help you until you upgrade.