Commit Graph

7365 Commits

Author SHA1 Message Date
Sebastian Markbage d5752aca0d findDOMNode when a component is not yet mounted or unmounted
First we need to check if a component subtree is mounted at all.

If it is, we need to search down the fiber for the first host
node. However, we might be searching the "work in progress"
instead of current.

One realization is that it doesn't matter if we search work in
progress or current if they're the same. They will generally be
the same unless there is an insertion pending or something in
the alternate tree was already deleted. So if we find one of
those cases, we switch to look in the alternate tree instead.
2016-10-25 13:59:34 -07:00
Sebastian Markbage 1914f94041 Handle unmounted and not-yet-inserted subtrees in isMounted
There are two cases where we have a Fiber that is not actually
mounted. Either it is part of a tree that has not yet been
inserted or it is part of a tree that was unmounted.

For the insertion case, we can check the parents to see if there
is any insertion effect pending along the parent path.

For deletions, we can now check if any of the return pointers
is null without actually being the root.
2016-10-25 13:59:34 -07:00
Sebastian Markbage 1376048bd9 Clear effectTag and return pointers after side-effects
This will let us use these pointers to reason about a tree.
Whether if it is "current" or "work in progress".
2016-10-25 13:59:33 -07:00
Sebastian Markbage 2e040fc2c1 Implement isMounted for Fiber
This is the naive implementation that doesn't cover the case
where it has completed but not yet committed. It also doesn't
deal with unmounts since they currently don't clean up the item
in the ReactInstanceMap.
2016-10-25 13:59:33 -07:00
Sebastian Markbage 298d0c3e05 Implement findDOMNode for Fiber
This is the naive implementation that doesn't cover the case where there are
two diverging fibers, or if this tree is unmounted.
2016-10-25 13:59:31 -07:00
Sebastian Markbåge e3131c1d55 Merge pull request #8086 from sebmarkbage/fiberdom
[Fiber] Reorganize files for DOM renderer to make overlap between fiber/stack clearer
2016-10-25 15:56:30 -04:00
Sebastian Markbage a3fb0310ca Reorganize files
This is just moving a bunch of DOM files.

It moves things into dom/stack and dom/fiber respectively. The
dom/stack folder remains split into client/server.

Mainly the shared folder is now my best guess for files that
we can reuse in fiber. Everything else will get forked or
reimplemented.

Also moved the event system out of renderers/shared/stack and
into renderers/shared/shared.
2016-10-25 10:54:14 -07:00
Sebastian Markbåge ea8cf7fbff Delete child when the key lines up but the type doesn't (#8085)
When keys line up in the beginning but the type doesn't
we don't currently delete the child. We need to track that this
fiber is a not a reuse and if so mark the old one for deletion.
2016-10-25 12:51:53 +01:00
Dan Abramov 225325eada Add Fiber Debugger (#8033)
* Build react-noop as a package

This lets us consume it from the debugger.

* Add instrumentation to Fiber

* Check in Fiber Debugger
2016-10-25 08:36:37 +01:00
Sebastian Markbage b26168cadb DefaultEventPluginOrder -> DOMEventPluginOrder
This is not a generic plugin order. It's DOM specific. Unlike
say DefaultBatchingStrategy which is used by Native too.
2016-10-24 19:59:04 -07:00
Sebastian Markbage 4ba8bef19a Split DefaultInjection into two files
This splits DefaultInjection into one with all the properties
and event configuration and a separate one for the things that
are relevant to he stack reconciler.

That way we can reuse the property and event system for Fiber
without pulling in all the other stuff.
2016-10-24 19:44:55 -07:00
Sebastian Markbage b0ccf62ea3 Get rid of ReactInjection
We don't use this indirection. It'll easier to break these apart
without it.
2016-10-24 19:16:56 -07:00
Dan Abramov 265ab83667 Respect state set in componentWillMount() on resuming (#8079)
When resuming creating new instance after resuming work, we should set the `state` on the newly creating instance rather than the old one.
2016-10-25 00:21:56 +01:00
Sergey Rubanov 9626c838cb Add npm v4.0.0 support (#8082) 2016-10-24 23:57:12 +01:00
Constantin Gavrilete 82d592a0fa removed duplicated 'the' (#8081) 2016-10-24 17:34:58 -05:00
Sebastian Markbåge 06e3b03132 Merge pull request #8078 from sebmarkbage/rmcomment
Remove copypasta comment
2016-10-24 13:49:51 -04:00
Sebastian Markbage 7991a00dcc Remove copypasta comment
Caught by @gaearon
2016-10-24 10:49:10 -07:00
Antti Ahti 954a70e591 Remove deprecated function from tests (#6536)
This has been deprecated since 2013 so it's about time to remove it.
2016-10-24 18:46:38 +01:00
Dan Abramov 14156e56b9 Strip PropTypes checkers in production build (#8066)
* Strip PropTypes in production build

* Revert "Warn if PropType function is called manually (#7132)"

This reverts commit e75e8dcbeb.
2016-10-24 18:43:31 +01:00
Dan Abramov e1ee94ca17 Add more highlighting to docs (#8076)
* Tweak JSX in Depth

* Add highlighting to Refs and the DOM

* More tweaks
2016-10-24 15:48:46 +01:00
Toru Kobayashi 6cdc610bcc [Fiber] Add types for ReactFiber and ReactChildFiber (#8072)
* Add Types for ReactFiber

* Add Types for ReactChildFiber
2016-10-24 14:20:44 +01:00
Marcio Puga 6fa1ddbdb4 Fix typos (#8067) 2016-10-24 13:50:04 +01:00
Ashish 8333b891e4 Docs : Fix createClass reference (#8073)
Currently react.createClass is wrongly referenced to #react.createclass. Changed it to #createclass!
2016-10-24 13:34:17 +01:00
Sebastian Markbåge 69d725f764 Merge pull request #8055 from sebmarkbage/fiberclassname
Accept className in ReactDOMFiber
2016-10-23 17:04:03 -04:00
Dan Abramov 156639241e Remove references to createClass in createElement docs (#8064) 2016-10-23 15:48:58 +01:00
Dan Abramov 46eca10046 Link to lifecycle methods from Context doc (#8062) 2016-10-23 14:35:23 +01:00
Andrew Poliakov 4e98dba6d3 Update tutorial.md, Taking Turns (#8058) 2016-10-23 13:49:55 +01:00
Alireza Mostafizi e527b3a464 Update handling-events.md (#8057) 2016-10-23 13:44:29 +01:00
William Hoffmann 29f5da8de4 Fix typo (#8056) 2016-10-23 13:44:08 +01:00
Giuseppe 74026fd9ea Docs replace reference to 'getInitialState' with 'state' instance property in "Thinking in React" (#8059) 2016-10-23 13:41:37 +01:00
Sebastian Markbage 51f1205fb4 Accept className in ReactDOMFiber
This isn't a complete solution to all attributes. It's just that
we run a lot of unrelated unit tests by testing className so
we need it for the tests.
2016-10-22 17:57:33 -07:00
Jason Grlicky 952bdca020 Fix for typos (#8046) 2016-10-22 16:50:24 -07:00
Jun Kim 284a96b9a6 Fix illogical code in tutorial.md (#8048)
The tutorial wants to throw a 'warning' and explains about 'key' of React's list, but it throws nothing since there is sensible key.
"key={move}" should be removed, and added after explaining about key.
2016-10-22 16:49:07 -07:00
Diego Muracciole 461a74115c Injected Host Component classes are not being considered by the reconciler (#8050)
* Consider Host Component classes when creating a new internal instance

* Remove unused tagToComponentClass & injectComponentClasses from ReactHostComponent
2016-10-22 17:28:37 -05:00
Phil Quinn cf37402338 correct order of params in documentation (#7989) 2016-10-22 21:59:54 +01:00
Brad Vogel 01753cde85 "take part in" is the correct saying (#8013) 2016-10-22 21:57:57 +01:00
Sebastian Markbåge 57f07777ef Fix relative link in Hello World (#8041)
* Fix relative link in Hello World

This links https://facebook.github.io/docs/installation.html which redirects to https://code.facebook.com/

* Update hello-world.md

* Fix link
2016-10-22 21:56:53 +01:00
Oskari Mantere 38c22252f4 Replace vars with let and const (#8051) 2016-10-22 21:55:29 +01:00
Avinash Kondeti 6810627a91 Fix: updated with new docs links (#8049) 2016-10-22 21:53:52 +01:00
Jun Kim 37f94bd3bb Fix typo in tutorial.md (#8047)
changges -> changes
2016-10-22 21:52:29 +01:00
Taeho Kim a5ff2f1e9c Fix typo in new tutorial code (#8045) 2016-10-22 21:46:51 +01:00
Nathan Hardy f7cb6cbe15 Fix erroneous '}' in JSX examples (#8043) 2016-10-22 21:45:29 +01:00
Cody Reichert 4d3c5ea23c Fix anchor link for displayName (#8040) 2016-10-22 21:44:51 +01:00
Ragnar Þór Valgeirsson 7340fa9d93 Convert the Number component to ListItem (#8039)
* Convert the Number component to ListItem

* Add updated example CodePen

Also fixes typos.
2016-10-22 21:44:28 +01:00
BEAUDRU Manuel 54dfe0b43c Wrong library name reference in tutorial.MD (#8038)
* Update tutorial.md

Seems like you are talking about immutable.js and not immutability.js which doesn't exist :)

* Capitalize Immutable.js
2016-10-22 21:43:15 +01:00
Ben Alpert fa82e3e9d6 Update website on Travis when only new files are added (#8037)
This build didn't commit the new files because no existing files were changed:

https://travis-ci.org/facebook/react/jobs/169622664

This should work better.
2016-10-22 21:41:29 +01:00
Christopher Chedeau 4812f26915 Update components-and-props.md
fb indent style
2016-10-21 18:30:25 -07:00
Christopher Chedeau eb118b7037 Update react-without-jsx.md
Facebook codestyle
2016-10-21 14:30:35 -07:00
Dan Abramov d1a61ee7f4 Fix redirects 2016-10-21 22:02:30 +01:00
Dan Abramov 1f818f2740 Minor doc tweaks 2016-10-21 21:47:43 +01:00