React: Ship 15.4.0

Created on 19 Sep 2016  ·  19Comments  ·  Source: facebook/react

This might be a little ways out, but going to start the process. We definitely want to run an RC here and push it through React Native. We'll want other people to play with it too. There's a big packaging change and it has potential to have issues.

Most helpful comment

I just published 15.4.0-rc.3.

Installation

npm i --save [email protected] [email protected]

If you use snapshot testing:

npm i --save-dev [email protected]

Please report issues!

There is a big change in how internals are organized. We are continuing to split React from ReactDOM internally, and in this release a bunch of internal modules has moved from react/lib/* to react-dom/lib/*. They were never a part of the public API so it's valid as a minor version, but we published this RC so that you have a chance to assess whether you or any libraries you depend on use private APIs, and raise issues with their maintainers before 15.4.0 is stable.

If your package depends on React internal APIs, consider copying the relevant code in your project. React makes no guarantees that any imports from /lib/ folders will ever be supported. They may technically break in any patch version even though we are taking extra steps to make it smooth. As a quick fix, you can replace react/lib/ with react-dom/lib/ and it will likely work, but many of those modules might get removed or further renamed in React 16. Please don't use internal modules of React.

If you found an issue in a popular React-related library that breaks in 15.4.0, please post here so that we keep track of them.

All 19 comments

I just published 15.4.0-rc.3.

Installation

npm i --save [email protected] [email protected]

If you use snapshot testing:

npm i --save-dev [email protected]

Please report issues!

There is a big change in how internals are organized. We are continuing to split React from ReactDOM internally, and in this release a bunch of internal modules has moved from react/lib/* to react-dom/lib/*. They were never a part of the public API so it's valid as a minor version, but we published this RC so that you have a chance to assess whether you or any libraries you depend on use private APIs, and raise issues with their maintainers before 15.4.0 is stable.

If your package depends on React internal APIs, consider copying the relevant code in your project. React makes no guarantees that any imports from /lib/ folders will ever be supported. They may technically break in any patch version even though we are taking extra steps to make it smooth. As a quick fix, you can replace react/lib/ with react-dom/lib/ and it will likely work, but many of those modules might get removed or further renamed in React 16. Please don't use internal modules of React.

If you found an issue in a popular React-related library that breaks in 15.4.0, please post here so that we keep track of them.

I'm getting:

Module not found: Error: Cannot resolve module 'react/lib/ReactMount'

@faalsh

If you didn't mean to install the RC please run:

npm i --save react@latest react-dom@latest

We published RC4 as latest by mistake but it wasn't meant to be installed automatically.

If you are trying out RC on purpose, please look at which library tries to import react/lib/ReactMount. It's likely not your code, is it? Then file an issue with that library.

@gaearon I'm trying out RC on purpose. Thanks for the tip, the error is caused by react-hot-loader.

RHL 1.x (which is the one relying on this internal module) has been unsupported for more than a year. Please migrate to 3.x if you'd like to keep using it. There are instructions linked from the first paragraph in its README.

Hi @gaearon, I am currently on [email protected] [email protected] [email protected] and [email protected] and when snapshot testing material-ui components with react-test-renderer I get the following error:

Invariant Violation: getNodeFromInstance: Invalid argument.

at invariant (node_modules/fbjs/lib/invariant.js:38:15)
      at Object.getNodeFromInstance (node_modules/react-dom/lib/ReactDOMComponentTree.js:155:77)
      at Object.findDOMNode (node_modules/react-dom/lib/findDOMNode.js:49:41)
      at ListItem.applyFocusState (node_modules/material-ui/List/ListItem.js:300:43)
      at MenuItem.applyFocusState (node_modules/material-ui/MenuItem/MenuItem.js:198:26)
      at MenuItem.componentDidMount (node_modules/material-ui/MenuItem/MenuItem.js:167:12)
      at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:265:25
      at measureLifeCyclePerf (node_modules/react-test-renderer/lib/ReactCompositeComponent.js:75:12)
      at node_modules/react-test-renderer/lib/ReactCompositeComponent.js:264:11
      at CallbackQueue.notifyAll (node_modules/react-test-renderer/lib/CallbackQueue.js:76:22)
      at ReactTestReconcileTransaction.ON_DOM_READY_QUEUEING.close (node_modules/react-test-renderer/lib/ReactTestReconcileTransaction.js:36:26)
      at ReactTestReconcileTransaction.TransactionImpl.closeAll (node_modules/react-test-renderer/lib/Transaction.js:206:25)
      at ReactTestReconcileTransaction.TransactionImpl.perform (node_modules/react-test-renderer/lib/Transaction.js:153:16)
      at batchedMountComponentIntoNode (node_modules/react-test-renderer/lib/ReactTestMount.js:69:27)
      at ReactDefaultBatchingStrategyTransaction.TransactionImpl.perform (node_modules/react-test-renderer/lib/Transaction.js:140:20)
      at Object.ReactDefaultBatchingStrategy.batchedUpdates (node_modules/react-test-renderer/lib/ReactDefaultBatchingStrategy.js:62:26)
      at Object.batchedUpdates (node_modules/react-test-renderer/lib/ReactUpdates.js:97:27)
      at Object.ReactTestMount.render [as create] (node_modules/react-test-renderer/lib/ReactTestMount.js:125:18)
      at Object.<anonymous> (src/components/app/__tests__/app.js:60:68)
      at process._tickCallback (internal/process/next_tick.js:103:7)

Repro if needed.

Any insights? Thanks.

@thisbejim It's not a regression though, is it? Did it ever work before?

@Aweary Can you look at https://github.com/facebook/react/issues/7770#issuecomment-255263096 please? My intuition is that we support mock "DOM" refs but not findDOMNode() at the moment.

@gaearon yupp, findDOMNodesupport was never implemented. This error is technically new since in 15.3.2 you would get the injectEnvironment() error before your tests had a chance to even call findDOMNode, but it's not technically a regression since it never worked.

I can look into what it would take for implementing findDOMNode support 👍

@gaearon Yeah my bad, I had been looking through other issues and wrongly assumed this was something that was planned to be fixed for this release.

Thank you for taking a look, @Aweary, I appreciate your time and effort.

In the meantime are there any workarounds? Cheers.

@thisbejim Would you be interested in fixing this?

@gaearon I do have some work done towards this, just didn't have a chance to finish it last week.

That said, if you want to work on this @thisbejim feel free to! 😄

@gaearon @Aweary As much as I'd love to help out I think it is very likely that this issue is way over my head. Will take a look at what Aweary is doing though to try and gain a better understanding of the problem.

@thisbejim just in case you missed it, we ended up concluding that supporting findDOMNode with the test renderer wasn't a good idea, see here

Thanks for the update @Aweary, much appreciated.

Update: For anyone else who has the findDOMNode error, the solution is to use Enzyme and enzyme-to-json to be compatible with snapshot testing.

I am encountering some issues with my react project using 15.4.0-rc.4 when trying to setup jest and enzyme. (More details here: stackOverflow Question )

Edit: fixed. Mostly merely dependency issues

I have however found an issue with the library chai-enzyme

It requires react/lib/ReactTestUtils (which now moved)

+-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| |   +-- [email protected]
| |   `-- [email protected]
| +-- react@^0.14.8 || ^15.0.1
| `-- [email protected]
|   +-- [email protected]
|   +-- [email protected]
|   | `-- [email protected]
|   +-- react@^15.3.2
|   +-- [email protected]
|   +-- [email protected]
|   | `-- [email protected]
|   +-- [email protected]
|   | +-- [email protected]
|   | `-- [email protected]
|   `-- [email protected]

I have however found an issue with the library chai-enzyme

Please file it with that library.

Reminder to whoever releases this: error code process.

cc @Aweary, @bgnorlov, @chenglou, @gaearon, @goatslacker, @hkal, @jedwards1211, @jessebeach, @keyanzhang, @mnpenner, @nhunzaker, @sebmarkbage – your changes are now shipped in React 15.4!

https://facebook.github.io/react/blog/2016/11/16/react-v15.4.0.html

Was this page helpful?
0 / 5 - 0 ratings