Commit Graph

7591 Commits

Author SHA1 Message Date
Sebastian Markbage cd0f963fa3 Fix up Flow annotations to be a bit more explicit where the unsoundness is 2016-11-18 17:59:36 +00:00
Dan Abramov 57f0cf376f Merge pull request #8345 from shubheksha/docs/improve-introducing-jsx
Improved some sections of the introducing JSX docs
2016-11-18 16:20:48 +00:00
Dan Abramov c47340acfb Small nit: add a sentence about readability back 2016-11-18 16:20:17 +00:00
Shubheksha Jalan e4432c7f76 Improved some sections of the introducing JSX docs 2016-11-18 21:09:34 +05:30
Sebastian Markbåge 751b76e351 Merge pull request #8319 from sebmarkbage/fiberdom
[Fiber] Fork ReactDOMComponent
2016-11-18 13:39:50 +00:00
Dan Abramov 919aa36d69 Merge pull request #8339 from nolanlawson/patch-1
Update 2016-11-16-react-v15.4.0.md
2016-11-18 12:27:16 +00:00
Dan Abramov 1c861a0d48 Merge pull request #8332 from gaearon/prod-dev
[Docs] Expand Installation and clarify why use bundlers
2016-11-18 12:26:22 +00:00
Dan Abramov 0b1d56399b Nits 2016-11-18 12:26:06 +00:00
Dan Abramov c91cc4d11a Nit 2016-11-18 12:25:23 +00:00
Sebastian Markbage 7246659f4d Consistent method vs function 2016-11-18 12:20:25 +00:00
Sebastian Markbage 836331ba5f Wire up ReactDOMFiberComponent in ReactDOMFiber
We'll need to do the DOM injection now.
2016-11-18 12:01:22 +00:00
Sebastian Markbage 61a1a50955 Split mountComponent into create and set initial properties
This lets us insert children in between these two steps.
2016-11-18 00:26:26 +00:00
Sebastian Markbage 4b017507e2 Don't pass the Fiber around instead use the DOM node
To avoid exposing the implementation details of fibers we'll just pass the
DOM node around instead. We'll attach any additional wrapper state on it.
We don't have to do it that way. We can also just invert the relationship
and put the node in the wrapper state.

I'll probably just get rid of the wrapper object and just put them as
expandos on the DOM.
2016-11-18 00:26:26 +00:00
Sebastian Markbage e962e97f75 Satisfy Flow by assuming value is an array for multi-select 2016-11-18 00:26:26 +00:00
Sebastian Markbage 6dc04b73a7 Assert that this is a script tag
Also, use a fixed string for the HTML since this is always a script tag.
2016-11-18 00:26:26 +00:00
Sebastian Markbage e58b050773 Pass the tag explicitly instead of reading it from the internal instance 2016-11-18 00:26:26 +00:00
Sebastian Markbage 2defc83f34 Stop using host parent/container internal objects
Instead we extract the namespace from the root element.
2016-11-18 00:26:26 +00:00
Sebastian Markbage d2888a7dea Get rid of server side support for <option />
We read the wrapper state during initial mount for server rendering support
but Fiber doesn't use it and we don't need it. We also can't because we
haven't yet completed the parent that has the selected.

I will need to remember to always insert children before setting the
selected value on the parent <select />. That way the DOM will deal with
the `selected` property of option properly.
2016-11-18 00:26:26 +00:00
Sebastian Markbage 2ef2a8e6f5 Pass props explicitly instead of getting them off currentElement
We don't store currentElement and I'm trying to get rid of accessing the
Fiber directly inside the host config.
2016-11-18 00:26:25 +00:00
Sebastian Markbage e42842f2cd getCurrentOwnerName
Instead of passing around the owner and the internal fiber everywhere we
can set current owner during each commit. That way we have it available
globally where ever we need it.

That way we don't have to pass it as a DEV only argument nor expose the
internal representation to the host config.

This doesn't actually get the current owner yet. Will do that in a follow
up.
2016-11-18 00:26:25 +00:00
Sebastian Markbage 43f07779c4 We only need the root attribute for warnings and server-side rendering
We don't need this for Fiber yet. We can possibly add an expando to check
if this is rendered with React or not.
2016-11-18 00:26:25 +00:00
Sebastian Markbage a1645322a7 Lint issues
Most dead code
2016-11-18 00:26:25 +00:00
Sebastian Markbage 3a856091be Add some Flow and get rid of the typecheck annotations 2016-11-18 00:26:25 +00:00
Sebastian Markbage aea55609bf No need for unmounting DOM components
We'll stop tracking the input value tracking. We'll also stop uncaching the
node because we can just let the garbage collector take care of that. This
makes it easier to release components in trees that never mounted.

This also removes an invariant error which is covered by unit tests.
This is necessary to separate regardless because we don't want this to
fire for a component that was started but was thrown away because it never
mounted. We can come back to that later.
2016-11-18 00:26:25 +00:00
Sebastian Markbage 77de47e378 Stop tracking event listeners on DOM nodes
Basically, we don't need to remove the event listeners because we can just
check if something is still mounted when they fire instead. We'll rely on
garbage collection to clean them up.
2016-11-18 00:26:25 +00:00
Sebastian Markbage e1ed610740 Remove the notion of transactions
We don't need to wait for the commit phase to start listening to events
since we have the node.

Next we'll stop unlistening to events too and instead just check isMounted.
2016-11-18 00:26:24 +00:00
Sebastian Markbage 7cd26b9c71 Manage children inside DOM properties
Fiber manages children separately so we don't need to do it here.
However, we special case the text content children and
dangerouslySetInnerHTML.

This reveals a bug that we currently don't handle the case where we switch
from dangerouslySetInnerHTML or text children to element children, because
child insertions are handled before the parent updates. We could possibly
handle this case by removing all nodes before the first host child but
that is a bit unfortunate.
2016-11-18 00:26:24 +00:00
Sebastian Markbage 7c5ec42350 Remove _domID
Not used by Fiber
2016-11-18 00:26:24 +00:00
Sebastian Markbage 4073dc79d7 Remove instrumentation and nesting warning
The nesting warning isn't as important now that we use createElement and
I don't want to deal with this just yet.
2016-11-18 00:26:24 +00:00
Sebastian Markbage 447e0a12b5 Get rid of the previousStyleCopy
We have warned about not mutating styles already. At this point we can just
freeze the style object in DEV.

That way we can read it from the previous props object without storing
another copy of it.

Also delete the associated warning.
2016-11-18 00:26:24 +00:00
Sebastian Markbage 151094ce03 Rely on lazy listeners 2016-11-18 00:26:24 +00:00
Sebastian Markbage 82e1d7dac3 Remove child nodes flag
We're always eager in Fiber.
2016-11-18 00:26:24 +00:00
Sebastian Markbage c8d877a4c4 Remove rootNodeID
We only use this to determine if something is mounted or not but I don't
think we really need to.
2016-11-18 00:26:24 +00:00
Sebastian Markbage e34e8974db Remove markup related paths 2016-11-18 00:26:24 +00:00
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
Nolan Lawson 1ff4158fa0 Update 2016-11-16-react-v15.4.0.md
Edge and IE11 both show user marks and measures in the Dev Tools, so it's technically not accurate to say that only Chrome has this feature.
2016-11-17 15:53:41 -08:00
Tom Occhino 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 Abramov bd529a0237 Merge pull request #8335 from lacker/newlink
add link to useful doc
2016-11-17 19:09:04 +00:00
Ben Alpert 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 Abramov 3d52856bb6 Update installation instructions on the blog 2016-11-17 16:05:49 +00:00
Dan Abramov db140c887f Explain Installation in more detail 2016-11-17 15:55:56 +00:00
Dan Abramov 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 Lacker ad347a3b92 include the version number in the header (#8315) 2016-11-16 16:26:21 -08:00
Marcy Sutton 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 Voyles 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
Tanner 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åge aca2e04036 Merge pull request #8232 from sebmarkbage/treetraversal
Add support for Fibers in ReactDOMComponentTree and ReactTreeTraversal
2016-11-16 16:59:32 +01:00