Commit Graph
7554 Commits
Author SHA1 Message Date
Sebastian Markbage ec178acf15 Turn ReactDOMFiberComponent into a singleton
And turn on Flow.
2016-11-18 00:26:23 +00:00
Sebastian Markbage 9c3e9fbb05 Fork ReactDOMComponent and the wrappers to Fiber
From now on any change to these have to be replicated to these files.

I will next start changing the implementation to work with Fiber.
2016-11-18 00:26:23 +00:00
Tom OcchinoandGitHub 32f5b034ed Upgrade ESLint and dependencies, fix new lint errors, switch Travis to Yarn (#8309)
* Update ESLint to 3.10.2

Also pull in fbjs for extending properly, per @zpao. This also disables consistent-return, which has about 80 failing cases in React currently. If we'd like to turn this back on, we should do it separately and fix all the call sites properly (rather than just adding 'return undefined;' everywhere, which adds no value.

Fixes to all existing lint errors plus an update for yarn.lock to follow.

* Update yarn.lock after the eslint update.

* Fix all new eslint failures

Unfortunately I had to add three eslint-disable-next-line instances. All have explanations inline.

* Switch Travis to use yarn instead of npm
2016-11-17 22:16:44 +00:00
Dan AbramovandGitHub bd529a0237 Merge pull request #8335 from lacker/newlink
add link to useful doc
2016-11-17 19:09:04 +00:00
Ben AlpertandGitHub 8ecb248e6d Make numerical refs work in Fiber (#8334) 2016-11-17 18:56:33 +00:00
Kevin Lacker 02966c7945 add link to useful doc 2016-11-17 10:49:02 -08:00
Dan AbramovandGitHub 862cedee94 Merge pull request #8317 from marcysutton/master
docs(forms): add missing labels to forms doc
2016-11-17 14:25:03 +00:00
Dan Abramov 3186a8b984 Tweak examples 2016-11-17 14:23:20 +00:00
Kevin LackerandGitHub ad347a3b92 include the version number in the header (#8315) 2016-11-16 16:26:21 -08:00
Marcy SuttonandGitHub e08be27b0c fix(a11y): add missing labels to forms doc
Showing how to create a form without labeling inputs is an accessibility anti-pattern. This change adds labels to the examples to address that. Codepen may still need to be updated depending on how that example is created.
2016-11-16 14:32:42 -08:00
Dave VoylesandKevin Lacker b20b99eb26 Clarity on constructor of Board object for tutorial.md (#8224)
* Update tutorial.md

Is it possible to be more clear here?
 This implies that we are removing the constructor from GAME, and not board (which is what I believe the author is trying to say).
It took me several reads to understand. 

With this edit, it is now clear that the adjustment is being made to -Board- and not to -Game-

* also remove "for Board earlier"
2016-11-16 13:24:45 -08:00
TannerandKevin Lacker 6cbdf90f19 Remove spread operator (#8273)
* Remove spread operator

I believe what was meant here was to express that you would create the new player object with all the previous properties of the existing player object in addition to now updating the score value. That being said, this is a simple example, and the player object clearly has no other values. Objects are not (by default) iterable using this operator, so this little piece does more harm than good. I believe the new example to be much clearer.

* Using Object.assign()

* Tweak wording
2016-11-16 11:59:16 -08:00
Sebastian MarkbågeandGitHub aca2e04036 Merge pull request #8232 from sebmarkbage/treetraversal
Add support for Fibers in ReactDOMComponentTree and ReactTreeTraversal
2016-11-16 16:59:32 +01:00
Sebastian Markbage 4e2688db4a Extract event listener from memoizedProps on Fiber instances
This makes some basic events work with Fiber.

This is however not a complete solution since we may be reading the wrong
Fiber.
2016-11-16 15:56:13 +00:00
Sebastian Markbage b3af02a3cd Add Fibers to ReactTreeTraversal
This traverses parent based on the type of internal instance it is passed.
If it is a Fiber it may have to traverse multiple steps until it finds a
HostComponent.

This will allow us to use the event system with Fiber.
2016-11-16 15:43:55 +00:00
Sebastian Markbage 57cc182f26 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 d1a003ee72 Update website for 15.4.0
(cherry picked from commit 5ce8853ccb)
2016-11-16 14:51:47 +00:00
tomocchino 66ee428a61 Update Changelog & Readme for 15.4.0
(cherry picked from commit 443683525f)
2016-11-16 14:51:38 +00:00
Dan AbramovandGitHub 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 OcchinoandGitHub 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ågeandGitHub 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 AbramovandGitHub 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 ClarkandGitHub 4528cddf51 Removes UpdateQueueNode.callbackWasCalled (#8290)
Tracking this isn't necessary.
2016-11-15 09:52:05 +00:00
Brandon DailandGitHub 024f62ecfe Merge pull request #8277 from qiuyuntao/master
docs: delete unnecessary brackets
2016-11-14 17:37:02 -06:00
Brandon DailandGitHub cdcbf2f39b Update reference-react-dom.md (#8285)
Add missing closing bracket
2016-11-14 17:35:32 -06:00
Dan AbramovandGitHub 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 AlpertandDan Abramov 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 AandGitHub 3a7b3b070b Update reference-react-dom.md
Add missing closing bracket
2016-11-14 10:33:07 +03:00
Ben AlpertandGitHub 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 AbramovandAndrew Clark 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 MainiandAndrew Clark 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