Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[FIX] - ReactDOM Add back version property to client #15780
Conversation
|
No significant bundle size changes to report.
Generated by |
|
Ping: |
|
Any updates on this? |
|
Is this going to be added? |
0d010e4
to
a4f9d91
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit a4f9d91:
|
|
Why is this necessary? Just do |
|
@milesj, First, this is the browser interface, in the browser I don't have direct access to package.json. You can expose it, of course, but when debugging production applications this is not something you want to do. Second, as I noted in the description of this pr All other interfaces (react, react-dom/server) still have it, and this is the only one where it doesn't exist. @typed also assumes it is there. All these lead me to believe that the version key got deleted by mistake when moving from react 15 to 16. |
|
I'm not sure if the decision to remove it was intentional or not. React DOM reports its version to DevTools (which necessarily needs some forking, since it supports many versions) but I think we might be cautious about having application code check this number. Usually it's better to feature detect specific APIs instead. I'm a little reluctant to add it back because I'm not sure how you're wanting to use it cc @gaearon and @sebmarkbage |
|
TBH I had no idea you could detect ReactDOM's version from devtools. When I created the PR we were debugging a production site with multiple versions of React present on the same page - some with legacy React15 code and some with React16. We experienced a React/ReactDOM version mismatch which resulted in hooks errors. When trying to debug it on the server both react and react-dom exposed their version, but in the client only react did so we couldn't really tell which version of React our code was using. The errors were not present in development. Working on this issue I assumed it got deleted by mistake since all other APIs still maintained the version property. If that's something that we don't plan on adding back then maybe I should create an opposite PR to fix |
|
Seems legit to bring the client into parity with the others. I ran this change by the team and there were no objections. Note that the version reported for experimental releases will be a little different, e.g. NPM version |
|
Out in 16.13 |
Change details
Adding back
.versionproperty to ReactDOM. It used to exist in React15 and got deleted. It still exists in ReactDOM/server, and it appears to be typed in @typed/react-dom so I am assuming it got deleted by mistake.