Commit Graph
7434 Commits
Author SHA1 Message Date
Andrew Clark b41883fc70 unstable_batchedUpdates
Implements batchedUpdates and exposes as unstable_batchedUpdates. All
nested synchronous updates are automatically batched.
2016-11-02 12:40:21 -07:00
Andrew Clark d153b1e27b Enqueue update and callback simultaneously
Without this fix, in non-batched mode, the update is scheduled first and
synchronously flushed before the callback is added to the queue. The
callback isn't called until the next flush.
2016-11-02 12:40:21 -07:00
Andrew Clark ecf468e556 Batch nested updates when in sync mode
Almost working...
2016-11-02 12:40:21 -07:00
Andrew Clark 78aef38bfa Add config to enable sync scheduling by default
I'll turn this on in ReactDOMFiber once I figure out batchedUpdates.
2016-11-02 12:40:20 -07:00
Andrew Clark 7b9ae92058 Updates should use the same priority context as top-level render
A bit of restructuring so that setState uses whatever the current
priority context is, like top-level render already does.

Renamed defaultPriority to priorityContext, and added a new variable
called defaultPriorityContext. Having two separate variables allows the
default to be changed without interfering with the current context.
2016-11-02 12:40:20 -07:00
Andrew Clark a07f5eede0 Synchronous work 2016-11-02 12:40:20 -07:00
Andrew Clark ab920970ae Ensure first iteration of performAnimationWork loop has right priority
I don't think this actually changes any behavior because of the way
findNextUnitOfWork works, but I think this is easier to follow.
2016-11-02 12:40:20 -07:00
Dan Abramov 2b26ea614d Fix the build (these tests were renamed) 2016-11-02 19:28:26 +00:00
Dan AbramovandGitHub 99be3781ef [Fiber] Add more tests for scheduling (#8183)
* Add more tests for scheduling

* Remove ambiguous terms
2016-11-02 17:49:22 +00:00
Sebastian MarkbågeandGitHub e5d85fbe04 Remove pendingUpdate optimization in ReactDOMSelect (#8175)
This removes an optimization that avoids call update on ReactDOMSelect
twice in an onChange event.

https://github.com/facebook/react/commit/2601b6a0b0c2b0bccaca67fbbfab6987ac5bef30#commitcomment-19643403

None of the other controlled components do this. The only reason to do it
here is because of the loop.

I'd like to remove this because I'd like to remove all the side-effects
that happen in onChange, other than user defined behavior. I'd also like to
get rid of state that track sequences. It is easier if everything is just
diffing.

Alternatively I can store the previous value that we processed and only
reprocess if the value has changed. However, that would requires the array
for multiple values to be immutable and I don't think we enforce that
right now.

In Fiber, I believe that we'll be able to batch both these updates into a
single commit.
2016-11-01 18:54:20 -07:00
Sebastian MarkbågeandGitHub 576542d0cf Handle the radio button case completely in the asap case (#8170)
Instead of scheduling individual callbacks to asap, we schedule one and
then do all the work in that one.

I'm doing this for architectural refactoring reasons.

Nevertheless, I'm adding a contrived unit test that this fixes. :)
2016-11-01 18:54:11 -07:00
Tetsuharu OHZEKIandDan Abramov 33ac5e8e4b [Fiber] Assign ReactTypeOfSideEffect to ReactFiber.Fiber.effectTag correctly (#8173)
The type of `ReactFiber.Fiber.effectTag` is `TypeOfSideEffect`.
Thus we should assign `ReactTypeOfSideEffect.NoEffect` value instead of
`ReactPriorityLevel.NoWork` even if they are same values.
2016-11-01 23:24:55 +00:00
Dan AbramovandGitHub 1a49b5f563 [Fiber] Fix infinite loop in scheduler and add more tests (#8172)
* Make test more complete

* Add a failing test for scheduling in reverse order

It hangs forever because we don't clear next pointer when unscheduling a root. Therefore, when it's scheduled again, it brings all its previous chain with it, potentially creating a cycle.

* Clear the next pointer when unscheduling a root

Fixes a potential infinite cycle when we reschedule a root.

* Add new tests to Fiber test tracker
2016-11-01 17:44:57 +00:00
Dan AbramovandGitHub ab02a03cad [Fiber] Add some scheduling tests (#8171)
* Extend ReactNoop to handle multiple roots

This lets us test scheduling between the roots.

* Add a few first tests for scheduler
2016-11-01 14:35:01 +00:00
Ben AlpertandGitHub 08b4cc53b8 Track passing/failing tests in fiber (#8169)
* Work around jest toEqual bug in ReactTreeTraversal

![image](https://cloud.githubusercontent.com/assets/6820/19879640/1cd7595a-9fb2-11e6-94ac-8c38bdfc90d3.png)

* Track passing/failing tests in fiber

Run scripts/fiber/record-tests to re-record, then check git diff to see what you changed.
2016-10-31 23:26:38 -07:00
Yura ChucholaandKevin Lacker abeae306e5 Update forms.md (#8136)
The component Form in "Uncontrolled Radio Button" example doesn't need state, because it does not used in render() method.
2016-10-31 17:35:20 -07:00
Sebastian MarkbågeandGitHub 34fd4f4aa0 Kill ReactLink, LinkedStateMixin, valueLink and checkedLink (#8165)
This should be safe because we've been warning for this. The LinkedStateMixin is technically exposed on React.addons without a warning but presumably you wouldn't be using it without a valueLink or checkedLink.

I do this primarily to clear up what the custom onChange listeners are doing.

Renamed the final prop type helper to ReactControlledValuePropTypes.
2016-10-31 16:45:01 -07:00
Damien SoulardandDan Abramov f53854424b update-unknown-warning-page - add a reason for the warning (#8131)
* update-unknown-warning-page - add a reason for this warning

* Minor tweaks
2016-10-31 13:01:06 +00:00
SkasiandDan Abramov abf37ea484 Remove duplicated word in doc (#8157)
Gets rid of an obsolete word in the documentation for "State and Lifecycle":

"Consider the ticking clock example from the one of the previous sections."
->
"Consider the ticking clock example from one of the previous sections."
2016-10-31 11:42:02 +00:00
bel3atarandDan Abramov 980cb01a84 add missing verb (#8139)
`why is an` should be `why it is an`
2016-10-31 11:41:43 +00:00
Dan AbramovandGitHub 264bed13ba [Fiber] Miscellaneous fixes to get more tests passing (#8151)
* Reset current owner when handling an error

* Make string ref deletion tests accept null

* Relax requirements on ref and render interleaving
2016-10-30 22:15:34 +00:00
Dan AbramovandGitHub c567b6e618 Remove use of reactComponentExpect in our tests (#8148) 2016-10-30 00:44:33 +01:00
Dan AbramovandGitHub c17bf38035 Get a few more Fiber tests passing (#8149)
* Get a few more Fiber tests passing

* Fix Flow and wrap in __DEV__
2016-10-30 00:43:34 +01:00
Robin RicardandDan Abramov 6d747a7426 [Fiber] Fix tests for Fiber in ReactElement-test (#8150)
* Test Fiber internals differently in ReactElement

Instead of being able to access the owner's instance via getPublicInstance(), we use the Fiber's stateNode. (Fiber does not have methods, it's just a structure!)

* Fix isCompositeComponentWithType for fiber

In ReactTestUtils.isCompositeComponentWithType, we provide a way to walk through Fiber's internals in place of using _currentElement.type. We keep support for non-fiber though.

* Test fiber reconciler consistently

Use typeof instance.tag to test if we're using the fiber reconciler

* Remove unnecessary comment
2016-10-30 00:42:59 +01:00
Dan AbramovandGitHub 928541dc9e [Fiber] Fix TestUtils.findAllInRenderedTree (#8147)
* [Fiber] Fix TestUtils.findAllInRenderedTree

* Add a comment about coroutines
2016-10-29 22:02:13 +01:00
Lee SanghyeonandDan Abramov f29a7bac0e Update codebase-overview.md (#8142)
* Update codebase-overview.md

Fix the broken source code URL in 'Event System' section.

* Update codebase-overview.md

Re-fix link name
2016-10-29 13:01:41 +01:00
Maksim ShastselandDan Abramov 9dc7a9594a Add support for node v7 (#8135) 2016-10-29 11:24:12 +01:00
Andrew LoandDan Abramov 1efb7a4e35 In the community support doc, I noticed that the React Facebook (#8138)
page link is broken since it's missing '.com'.
2016-10-29 00:31:01 +01:00
Andrew ClarkandGitHub 1152ced3dc Merge pull request #8133 from gaearon/error-boundaries-more
[Fiber] Error boundaries should handle errors independently
2016-10-28 14:58:54 -07:00
Dan Abramov ed11b35302 The issue with tests is solved now 2016-10-28 21:48:37 +01:00
Dan Abramov d8441cd725 Handle multiple errors in boundaries 2016-10-28 21:22:59 +01:00
Dan Abramov c08469a7d6 Add tests verifying we don't swallow exceptions 2016-10-28 21:22:59 +01:00
Dan Abramov f51abe0b55 Add a failing test for multiple independent boundaries
Now that commits are treated as atomic, it is possible that componentDidMount, componentDidUpdate, or componentWillUnmount threw in multiple places during the commit. We need to make sure we notify all affected boundaries of the first errors in them.
2016-10-28 21:22:58 +01:00
Dan Abramov bd3c90ac6f Add more tests for error boundaries 2016-10-28 21:22:58 +01:00
Gant LabordeandKevin Lacker 6825773882 Organize and add confs (#8129)
Upcoming proximity followed by past chronological.
2016-10-28 11:21:21 -07:00
mfijasandBen Alpert 4bca777131 Updated tutorial.md (#8054)
Fixed method name (renderStep -> renderSquare).
Removed <li>'s key to present the warning described below the code fragment.
2016-10-28 10:28:44 -07:00
Dan AbramovandGitHub 3c6abbfff7 [Fiber] Error Boundaries (#8095) 2016-10-28 10:29:14 +01:00
Sebastian MarkbågeandGitHub 308e0b7786 Merge pull request #8128 from sebmarkbage/fiberdom
[Fiber] Some early refactoring to be able to reuse the event system
2016-10-27 23:18:43 -07:00
Sebastian Markbage ea47782aaa Create ReactGenericBatching injection wrapper around BatchedUpdates
This moves calls that don't know if they're in a Fiber or Stack
context to use ReactGenericBatching.batchedUpdates.

The corresponding one will be injected from either the stack
reconciler and/or the fiber reconciler if they're loaded at the
same time.

This lets them share the event system when they're both used
at once.

This can also be useful for libraries that call
unstable_batchedUpdates today but don't know which renderer to
use.
2016-10-27 18:57:30 -07:00
Sebastian Markbage 2f8d1689db Refactor ResponderEventPlugin to not rely on _rootNodeID
Instead of relying on IDs, we now use instances for everything so
this should be reflected by the test.

This still has a _rootNodeID to store the listeners which I will
remove next.
2016-10-27 18:54:15 -07:00
EugeneandDan Abramov 0e23880d22 Update reference-react-component.md (#8126)
line 320: For example, this code ensures that the `color` prop is a string
2016-10-27 19:25:43 +01:00
Rick BeerendonkandKevin Lacker 346dcaacfa Add React Remote Conf 2016. (#8094)
Add video links to some conferences.
2016-10-27 11:25:14 -07:00
Sebastian Markbage 2633a4284f Move more files into stack reconciler
CallbackQueue and Transaction are specific to the stack
reconciler.
2016-10-27 11:04:23 -07:00
Dan AbramovandGitHub e1b140225a Clarify how transition props work (#8124) 2016-10-27 14:21:34 +01:00
Ivan ZotovandDan Abramov b3b13919c7 Improve devtools image size for the tutorial (#8114) 2016-10-27 13:54:18 +01:00
Andreas MöllerandDan Abramov 1e126c29dd Fix: Remove unneeded else branches from documentation examples 2016-10-27 13:12:37 +01:00
Dan Abramov a4b9abff42 Consistent CodePen links in docs 2016-10-27 13:06:09 +01:00
Ivan ZotovandDan Abramov 6fec6507ed Fix lint errors (#8113) 2016-10-27 13:03:32 +01:00
Varun BhuvanendranandDan Abramov 603b7194dc added word break (#8120) 2016-10-27 13:01:51 +01:00
Lewis BlackwoodandDan Abramov dba8f25854 Correct usage of formatName() function in docs (#8122)
The code section above these changes defines a `formatName` function
that expects a parameter `user`. The code section containing these
changes incorrectly called `formatName(user.name)`. For those following
along with CodePen, this section should correctly call
`formatName(user)`.
2016-10-27 13:01:04 +01:00