Commit Graph

7536 Commits

Author SHA1 Message Date
Dan Abramov
203d3fb25e Merge pull request #8293 from gaearon/154-post
Add 15.4.0 blog post
2016-11-16 14:45:26 +00:00
Dan Abramov
e8c07b0a45 Add 15.4.0 blog post 2016-11-16 14:36:20 +00:00
Tom Occhino
9589c726da Fix a line-length warning (#8298)
Test Plan: npm run lint / yarn run lint
2016-11-16 10:33:16 +00:00
Sebastian Markbåge
dde670fd36 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 Abramov
4029ccd650 Merge pull request #8272 from gaearon/fiber-context
[Fiber] Initial implementation of context
2016-11-15 17:14:12 +00:00
Dan Abramov
2397f1fce6 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
1e42c1833c Add explicit tests for intermediate components 2016-11-15 16:08:15 +00:00
Dan Abramov
fd8c8038f0 Update passing tests 2016-11-15 14:49:54 +00:00
Dan Abramov
a6ee5b876a 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
299009c41f Add test cases for context below and above setState 2016-11-15 13:23:29 +00:00
Andrew Clark
4528cddf51 Removes UpdateQueueNode.callbackWasCalled (#8290)
Tracking this isn't necessary.
2016-11-15 09:52:05 +00:00
Brandon Dail
024f62ecfe Merge pull request #8277 from qiuyuntao/master
docs: delete unnecessary brackets
2016-11-14 17:37:02 -06:00
Brandon Dail
cdcbf2f39b Update reference-react-dom.md (#8285)
Add missing closing bracket
2016-11-14 17:35:32 -06:00
Dan Abramov
137029be31 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
eedca6f641 Disable memoized props bailout when context might have changed 2016-11-14 18:24:32 +00:00
Dan Abramov
56e1c126c5 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
f9e1bc9c97 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
c22b7a001c 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
4ba0eb9158 Add a test for recursive context 2016-11-14 13:32:09 +00:00
Dan Abramov
e6a0de5463 Fix bad ops.length assignment in tests 2016-11-14 13:32:09 +00:00
Dan Abramov
b8cca3711e Update passing tests 2016-11-14 13:32:09 +00:00
Dan Abramov
a05d1abee8 Minor style tweaks 2016-11-14 13:29:42 +00:00
Dan Abramov
12bee76ff7 Implement basic support for context 2016-11-14 13:29:42 +00:00
Dan Abramov
9a42f8a0c5 Update passing tests 2016-11-14 13:22:47 +00:00
Ben Alpert
4aa9cfb6ba Change warnings to use expectDev 2016-11-14 13:22:41 +00:00
Dan Abramov
69fc4d32b5 Minor style tweaks 2016-11-14 12:56:11 +00:00
Dan Abramov
c8451bd0d8 Catch first error from setState updaters 2016-11-14 12:55:59 +00:00
Anastasia A
3a7b3b070b Update reference-react-dom.md
Add missing closing bracket
2016-11-14 10:33:07 +03:00
Ben Alpert
64cba04bf9 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 Abramov
c6f10e2cee 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
41b4d3958c docs: delete unnecessary brackets 2016-11-13 16:29:18 +08:00
Ankeet Maini
077822e9d0 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 Scheiderich
9d201918bf 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 Abramov
b9f65d9b1d Fix reactComponentExpect.toBeDOMComponentWithChildCount(0) regression (#8271)
This should fix 3e2680411e (commitcomment-19788988).
2016-11-11 17:26:19 +00:00
Sebastian Markbåge
4804518c26 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 Bertoli
53e45e78e4 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 Dail
e43aaab254 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 Abramov
da021ca4ae Use ReactDOM.unstable_batchedUpdates in Fiber tests (#8263) 2016-11-10 21:28:49 +00:00
Dan Abramov
a9fa135fd8 [Fiber] Fix reactComponentExpect (#8258) (#8257)
* Add more reactComponentExpect tests

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

* Implement reactComponentExpect in Fiber
2016-11-10 21:19:57 +00:00
Ben Alpert
67dcc5861c Flow 0.34 (#8259) 2016-11-10 11:52:32 -08:00
Dan Abramov
e612826650 Revert "temporary compatibility fix" (#8256)
This reverts commit bba0d992d8.
2016-11-10 16:03:22 +00:00
Eoin Hennessy
6ce8f1f93c Refactor precacheChildNodes slightly (#8018)
This ‘fixes’ a bizarre IE9 script engine issue. #7803
2016-11-10 16:02:48 +00:00
Shuhei Kagawa
fa4710fe51 Correct a method param in Implementation Notes (#8252) 2016-11-10 14:19:27 +00:00
Satoshi Nakajima
3e708497d2 Replaced old refs with new callback refs (#8254) 2016-11-10 14:13:56 +00:00
Arni Fannar
f4059e5e5b 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 Oenning
b847226ec4 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
jddxf
8267e1152e #8021 (#8241)
Fix gulp tasks: eslint and flow error on Windows
2016-11-09 16:51:02 +00:00
Ville Immonen
3668a2e678 Remove string ref from function component example (#8244)
Refs can't be attached to stateless functional components.
2016-11-09 16:38:36 +00:00
Toru Kobayashi
d0a8d8b951 [Fiber]Warn when shoulcComponentUpdate returns undefined (#8243)
* [Fiber]Warn when shoulcComponentUpdate returns undefined

* Remove unnecessary fallback
2016-11-09 16:30:41 +00:00