Commit Graph
7539 Commits
Author SHA1 Message Date
Sebastian Markbage 52724ad77b Add Fibers to ReactDOMComponentTree
This adds precaching to ReactDOMFiber. I.e. adding a handle from the DOM
node to the internal Fiber. This means that we need to expose an internal
handle to the reconciler.

We use duck typing to figure out if it is a Fiber or Stack instance.

The new failing tests are failing because this is now able to actually
fire events onto Fibers and then the result of those events are
incorrect where as they were ignored before.
2016-11-16 15:42:39 +00:00
tomocchino 7bf98b47c4 Update website for 15.4.0
(cherry picked from commit 5ce8853ccb2e4677eb6a9d183e8086fd0d6367d4)
2016-11-16 14:51:47 +00:00
tomocchino 5abd6bf40c Update Changelog & Readme for 15.4.0
(cherry picked from commit 443683525fd8c0721f21a8f23021d4eac73b5929)
2016-11-16 14:51:38 +00:00
Dan AbramovandGitHub 5c83c7545f Merge pull request #8293 from gaearon/154-post
Add 15.4.0 blog post
2016-11-16 14:45:26 +00:00
Dan Abramov 83af045074 Add 15.4.0 blog post 2016-11-16 14:36:20 +00:00
Tom OcchinoandGitHub 9b627fbbf3 Fix a line-length warning (#8298)
Test Plan: npm run lint / yarn run lint
2016-11-16 10:33:16 +00:00
Sebastian MarkbågeandGitHub 4a7558f748 Reapply Check for event listener in props instead of bank (#8292)
* Reapply Check for event listener in props instead of bank (#8192)

This reverts the previous revert.

* Don't throw on falsy event listeners

Some code relies on passing null. This restores the earlier behavior.
2016-11-15 18:16:27 +01:00
Dan AbramovandGitHub e8654a107d Merge pull request #8272 from gaearon/fiber-context
[Fiber] Initial implementation of context
2016-11-15 17:14:12 +00:00
Dan Abramov 8824e661b5 Use empty object if context does not exist
This matches Stack behavior.
Had to rewrite a test that used Simulate because Fiber doesn't support events yet.
Also changed tests for componentDidUpdate() since Fiber intentionally doesn't pass prevContext argument.
2016-11-15 16:35:00 +00:00
Dan Abramov 3e86f1d5ce Add explicit tests for intermediate components 2016-11-15 16:08:15 +00:00
Dan Abramov a43239313f Update passing tests 2016-11-15 14:49:54 +00:00
Dan Abramov 30599d0032 Memoize merged child context when possible
We can avoid recreating the merged context object if the context provider work was reused. This is essential to avoid allocations for deep setState() calls.
2016-11-15 14:41:59 +00:00
Dan Abramov a4a5087c80 Add test cases for context below and above setState 2016-11-15 13:23:29 +00:00
Andrew ClarkandGitHub 8f77be69fc Removes UpdateQueueNode.callbackWasCalled (#8290)
Tracking this isn't necessary.
2016-11-15 09:52:05 +00:00
Brandon DailandGitHub d4761d8d4a Merge pull request #8277 from qiuyuntao/master
docs: delete unnecessary brackets
2016-11-14 17:37:02 -06:00
Brandon DailandGitHub efd57cdd69 Update reference-react-dom.md (#8285)
Add missing closing bracket
2016-11-14 17:35:32 -06:00
Dan AbramovandGitHub b9a8cdac7a Catch first error from setState callbacks (#8287)
* Catch first error from setState updaters

* Minor style tweaks
2016-11-14 18:27:38 +00:00
Dan Abramov 53b1d1edcf Disable memoized props bailout when context might have changed 2016-11-14 18:24:32 +00:00
Dan Abramov cbf133aa98 Move context handling back into Begin and Complete phases
As per discussion, this is better because then this code only runs for the class type of work. We will still need to fix bailouts for deep setState calls.
2016-11-14 16:22:10 +00:00
Dan Abramov 2edd220a5f Move context management into scheduler
It is error-prone to push and pop context in begin or complete phases because of all the bailouts. Scheduler has enough knowledge to see if pushing is necessary because it knows when we go inside or outside the tree.
2016-11-14 13:32:09 +00:00
Dan Abramov 73eaec6ad2 Add a failing test for context when reusing work
We mistakingly forget to push the context if the parent is being reused but the child is not.
2016-11-14 13:32:09 +00:00
Dan Abramov c638c01b29 Add a test for recursive context 2016-11-14 13:32:09 +00:00
Dan Abramov 845ae65448 Fix bad ops.length assignment in tests 2016-11-14 13:32:09 +00:00
Dan Abramov 722fa1fced Update passing tests 2016-11-14 13:32:09 +00:00
Dan Abramov 49f8ae2d45 Minor style tweaks 2016-11-14 13:29:42 +00:00
Dan Abramov 8d49ccb92f Implement basic support for context 2016-11-14 13:29:42 +00:00
Dan Abramov fcfcd1e473 Update passing tests 2016-11-14 13:22:47 +00:00
Ben AlpertandDan Abramov 3f82b23d76 Change warnings to use expectDev 2016-11-14 13:22:41 +00:00
Dan Abramov 9b20089e72 Minor style tweaks 2016-11-14 12:56:11 +00:00
Dan Abramov a912747174 Catch first error from setState updaters 2016-11-14 12:55:59 +00:00
Anastasia AandGitHub c47f810e3f Update reference-react-dom.md
Add missing closing bracket
2016-11-14 10:33:07 +03:00
Ben AlpertandGitHub 44a12ba71b Build infra for tracking dev-specific failures (#8228)
I'll plan to change all of our console.error and component-tree expects to expectDev. It's a little annoying that we need to make sure tests don't throw (see my change to normalizeCodeLocInfo) but any alternative would seem to require two separate test runs or a much more cumbersome syntax.
2016-11-13 14:00:07 -08:00
Dan AbramovandAndrew Clark b5d5c0900e Change a test to be relevant in Fiber (#8281)
Fiber supports fragments so we will use undefined instead.
This test is then valid both in Stack and in Fiber.
2016-11-13 10:40:21 -08:00
yuntao.qyt f27af62239 docs: delete unnecessary brackets 2016-11-13 16:29:18 +08:00
Ankeet MainiandAndrew Clark 6e3936b903 Handles risky callbacks on setState. Fixes #8238 (#8242)
* Handles risky callbacks on setState. Fixes #8238

* Updates try-catch to cover `callback` when context is not present.

* Updates code to trapErrors instead of swallowing them.

* Fixes flow errors

* Incorporates review comments

* Traps only the first error.

Removes `callbackWasCalled` and updates fiber tests.
2016-11-12 12:51:36 -08:00
Samuel ScheiderichandKevin Lacker 07fe702717 Add freenode #reactjs link to support.md (#8270)
* Add freenode #reactjs link to support.md

* Changed irc link to http webchat link.
2016-11-11 13:21:46 -08:00
Dan AbramovandSebastian Markbåge 6ee847db3e Fix reactComponentExpect.toBeDOMComponentWithChildCount(0) regression (#8271)
This should fix https://github.com/facebook/react/commit/d87496fcce87e5425a5f8146fcb1eafd20bbae1c#commitcomment-19788988.
2016-11-11 17:26:19 +00:00
Sebastian MarkbågeandGitHub 5247c4ec72 Handle nested controlled events (#8251)
I came up with a contrived case of where nested controlled events could
fire within the same batch - but on different targets.

I think we came to the conclusion that controlled values typically cannot
use preventDefault so it is ok that they don't flush until after the event
has finished. So therefore we accumulate a queue of all the nested targets
within a batch and then restore state on all of them.

I'm still skeptical that this is the correct way to do controlled values.
The reason we have to do them in a single event loop is because when you
type, the sequence of values that get accepted or not can matter. I wonder
if there is a scenario we can come up with where you can fire multiple
inner events in an event loop and end up with batching causing problems.

This effectively just reimplements asap again but with no allocations for
a single target and no closure allocations.
2016-11-11 16:49:59 +00:00
Michele BertoliandDan Abramov abff681876 Make the Shallow Rendering example clearer (#8269)
* Make the Shallow Rendering example clearer

I was reading through the documentation, and I found that the `render` call on the `renderer` was missing.

* Use a regular function to define MyComponent
2016-11-11 15:34:11 +00:00
Brandon DailandDan Abramov d8bac6d31d Use _hostContainerInfo to track test renderer options (#8261)
* Use _hostContainerInfo to track test renderer options

The transaction is not available when unmounting or updating the
instance, so we track it using _hostContainerInfo

* Throw if hostContainerInfo is not populated in getPublicInstance

* Linting fixes

* Remove transaction from ref lifecycle code path

We don't need to pass the transaction around anymore since we store the
test options on _hostContainerInfo instead

* Remove unused argument
2016-11-11 14:35:18 +00:00
Dan AbramovandGitHub 6b0b9e23b6 Use ReactDOM.unstable_batchedUpdates in Fiber tests (#8263) 2016-11-10 21:28:49 +00:00
Dan AbramovandGitHub 6852bf5fe3 [Fiber] Fix reactComponentExpect (#8258) (#8257)
* Add more reactComponentExpect tests

* Implement reactComponentExpect in Fiber
2016-11-10 21:27:07 +00:00
Dan AbramovandGitHub d87496fcce [Fiber] Fix reactComponentExpect (#8258)
* Add more reactComponentExpect tests

* Implement reactComponentExpect in Fiber
2016-11-10 21:19:57 +00:00
Ben AlpertandGitHub 2908a2a6fc Flow 0.34 (#8259) 2016-11-10 11:52:32 -08:00
Dan AbramovandGitHub 3b16e30417 Revert "temporary compatibility fix" (#8256)
This reverts commit c028f12238.
2016-11-10 16:03:22 +00:00
Eoin HennessyandDan Abramov 9a8f3d922c Refactor precacheChildNodes slightly (#8018)
This ‘fixes’ a bizarre IE9 script engine issue. #7803
2016-11-10 16:02:48 +00:00
Shuhei KagawaandDan Abramov a6beb66ffc Correct a method param in Implementation Notes (#8252) 2016-11-10 14:19:27 +00:00
Satoshi NakajimaandDan Abramov e57269d5e1 Replaced old refs with new callback refs (#8254) 2016-11-10 14:13:56 +00:00
Arni FannarandKevin Lacker a0b7fcfa37 Update refs-and-the-dom.md (#8250)
Since a lot of projects use [airbnb eslint config](https://www.npmjs.com/package/eslint-config-airbnb) where [this rule](http://eslint.org/docs/rules/no-return-assign) is enabled (and its a good rule) some people might get confused when they are trying this out in their project.
2016-11-09 14:45:21 -08:00
Guilherme OenningandDan Abramov eb908e9d50 fix broken docs links (#8163)
* fix broken links to outdated code

* another broken links to outdated code

* update hash commit & folder structure to current
2016-11-09 18:06:35 +00:00