Commit Graph
7649 Commits
Author SHA1 Message Date
brilloutandDan Abramov 3da9d79c54 remove dead link (#8411) 2016-11-24 14:35:48 +00:00
Sebastian MarkbågeandGitHub dfb1e567c8 Merge pull request #8400 from sebmarkbage/fibercontainerchildren
[Fiber] Update root children using appendChild/insertBefore/removeChild
2016-11-23 18:09:50 -08:00
Ben AlpertandGitHub cfcf7d978e Finish ReactGenericBatching (#8405) 2016-11-23 17:40:20 -08:00
Sebastian Markbage f97f73da4b Split initial children out of createInstance
The goal of this is to avoid passing an opaque data structure that needs
to be recursively searched by the host.

I considered having some helper for doing the recursion but I figured it
might be helpful to let the reconciler move this around. For example we
might want to create an instance in beginWork and add to it as we go.
This would let us avoid traversing the tree twice and would solve the IE11
perf issue.

So instead, we create the instance first then call appendChild. I could
just call the normal one but I figured that I would make a special one
just in case. For example if you wanted to perform commits on a separate
thread from creation. This turned out to be useful in ReactNoop where I
can avoid searching the array for an existing one since I know the child
isn't there already. (Although splitting placement into insertion/move
might be better.)

Finally, we need the ability to update an instance after all the children
have been insertion. Such as `<select value={...} />`. I called this
finalizeInitialChildren.
2016-11-23 17:38:35 -08:00
Dan AbramovandSebastian Markbage 2135c9e70c Remove recursion from unmounting portals (#1) 2016-11-23 17:38:35 -08:00
Sebastian Markbage 2750ad36f6 Assert that we always find a parent for DOM mutations 2016-11-23 17:38:35 -08:00
Sebastian Markbage f951f3b580 Update root children using the appendChild/insertBefore/removeChild methods
This removes updateContainer and instead uses the regular child mutation
methods to insert into the root container and portals.

Since we're no longer clearing out the container DOM in updateContainer
we have to do that manually during initial mount. This now works on a
document and one of the tests end up unmounting the body when you render
into the document so I had to work around that bit since we don't yet
properly support rendering into the document root.
2016-11-23 17:38:35 -08:00
Ben Alpert ee5c1ab07e Lint 2016-11-23 17:31:41 -08:00
Ben AlpertandGitHub 7582cef180 Fix traversal up when unmounting (#8404)
Previously you could get an alternate when following .return in unmountHostComponents and this could revisit a node twice.
2016-11-23 16:07:25 -08:00
Ben Alpert baece8626f Re-record 2016-11-23 15:22:35 -08:00
Ben AlpertandGitHub 958743a3df Preserve scroll position when restoring focus (#8401)
This misbehavior is particularly egregious because of our current strategy for updating a container in Fiber, but regardless -- if we restore focus to an offscreen node (ex: because it was reordered among its siblings) then we should not scroll the page to reveal it.

We could check the `overflow` computed style values before saving the scroll positions but that's unlikely to be any faster.
2016-11-23 14:55:17 -08:00
Sebastian MarkbågeandGitHub 3607d23fde Remove config.beginUpdate (#8402)
I only used this to visualize changes when there were bugs in the
incremental reconciliation. We don't need it anymore.
2016-11-23 14:44:17 -08:00
Ben AlpertandGitHub d7994a2096 Cleanup after #8353 (#8403) 2016-11-23 14:43:52 -08:00
Ben AlpertandGitHub 9b262a3fa5 Fix renderSubtreeIntoContainer with non-context-provider parent (#8399) 2016-11-23 14:23:45 -08:00
Ben AlpertandGitHub a9a9c176ca Restore DOM selection and suppress events (#8353)
This makes Draft mostly work.
2016-11-23 13:43:00 -08:00
Ben AlpertandGitHub f5b2a96068 Fix queueing updates in cWM/cWRP when batching (#8398)
I tried to add a temporary check for the correct state in https://gist.github.com/spicyj/338147e989215b6eeaf48a6ce2d68d93 and run our test suites over it, but none of our existing test cases would have triggered that invariant. The new one I added does.
2016-11-23 13:00:49 -08:00
Sebastian MarkbågeandGitHub 91a9a01e99 Change the behavior to always fail childContextTypes if there is a method (#8391)
Even if that method returns falsy values.
2016-11-23 10:59:49 -08:00
Paul O’ShannessyandBen Alpert 90f4bf829c Fix browser bundle for AMD (#8374)
* Fix browser bundle for AMD

* Final fix for standalone browser build.

Much more scientific than the rest so it should stick.

* Throw when we can't find code we need to replace.
2016-11-22 17:16:45 -08:00
Sebastian MarkbågeandGitHub 92139581ab Merge pull request #8365 from sebmarkbage/fiberdom
[Fiber] Fix more tests
2016-11-22 16:19:15 -08:00
Sebastian Markbage dda1a7b2d4 Passing disabled events 2016-11-22 16:16:47 -08:00
Sebastian Markbage a6f803cdbf Utilize the backtracking during events to figure out if a Fiber was unmounted
We're walking backwards up to the root to find the parent so that we can
propagate events further up to nested React parents. If we don't find a
root, that means that the tree was unmounted and we shouldn't send any
events to it.
2016-11-22 16:16:47 -08:00
Sebastian Markbage bfc945c1dd Preserve the original object when using replaceState
When we use only replace state we don't need to clone the object.
2016-11-22 16:16:46 -08:00
Sebastian Markbage 2b11c4fc0e Disable one irrelevant test for Fiber
We don't use transaction objects.
2016-11-22 16:16:46 -08:00
Sebastian Markbage f9e84e0b11 Don't test for comments in empty components for Fiber
Fiber doesn't use comments in empty components.
2016-11-22 16:16:46 -08:00
Sebastian Markbage f1aaa189a9 Implement the same search strategy in ReactTestUtils as findDOMNode
This was supposed to fix an issue in refs-test but instead it revealed that
this strategy is broken.

The problem is that Placement effect is not sufficient when the insertion
is completed since the effect flag is reset then and the previous tree
has no effects in it to indicate that this is the wrong tree.
2016-11-22 16:16:46 -08:00
Sebastian Markbage 21babc7fd5 Fix findDOMNode for empty children
If there is no child there is nothing to tell us that this was the
workInProgress branch. Therefore, we need to look at the other branch
if there are children in it to see if *that* was the workInProgress branch.
2016-11-22 16:16:46 -08:00
Sebastian Markbage aec33521db Drop "previous style" copy from Stack to bring it inline with Fiber
We've already been warning for mutating styles so now we'll freeze them
in DEV instead. This isn't as good because we don't have more specific
warnings than the generic error that doesn't even fire in sloppy mode.

This lets Fiber pass the same tests.
2016-11-22 16:16:46 -08:00
Sebastian Markbage a8eee81a04 Track inputs after setting its properties
This used to be done at the end of the transaction but I made it synchronous.

For this to work it needs to be applied after we have already set the .type
property since it is read by inputValueTracker.
2016-11-22 16:16:45 -08:00
Sebastian Markbage 095c9d76cc Update the internal Fiber on the DOM node to always be the current
We need this to safely extract the current event listeners from the props.
Unfortunately, we are still not safe to use the return pointer since it
may not point to the current tree when the Fiber is reused. So this is not
fully done yet.
2016-11-22 16:16:45 -08:00
Sebastian Markbage 6fb96a314f Allow EventListener to traverse up the tree until it hits the root
We use this to find the root node so that we can look for outer React
subtrees if this is nested.
2016-11-22 16:16:45 -08:00
Benoit GirardandBen Alpert cbc87cd828 Include ReactDebugTool from inside __DEV__ to save 1.5KB (#8322) 2016-11-22 16:08:45 -08:00
Sebastian MarkbågeandGitHub 12f8898edf Nit in regexp (#8388) 2016-11-22 16:06:31 -08:00
Sebastian MarkbågeandGitHub 4e4a78068d [Fiber] Make server rendering tests pass (#8372)
* Use the public ReactDOMServer in tests

We need this because it runs the injection.

* Let Fiber skip react data attributes and comments in SSR tests

This markup is testing implementation details rather than behavior.
2016-11-22 16:03:50 -08:00
Ben AlpertandGitHub c8e6a17347 Stopgap fix for element disabling (#8387)
Fix for #8308. This is a bad hack -- EventPluginHub.getListener isn't even DOM-specific -- but this works for now and lets us release 15.4.1.
2016-11-22 14:39:30 -08:00
Dan AbramovandGitHub ffdce3a343 [Fiber] Add ReactDOMFiber.unstable_createPortal() (#8386)
* [Fiber] Add ReactDOMFiber.unstable_createPortal()

While #8368 added a version of `ReactDOM.unstable_renderSubtreeIntoContainer()` to Fiber, it is a bit hacky and, more importantly, incompatible with Fiber goals. Since it encourages performing portal work in lifecycles, it stretches the commit phase and prevents slicing that work, potentially negating Fiber benefits.

This PR adds a first version of a declarative API meant to replace `ReactDOM.unstable_renderSubtreeIntoContainer()`. The API is a declarative way to render subtrees into DOM node containers.

* Remove hacks related to output field
2016-11-22 22:08:13 +00:00
Ben AlpertandGitHub e586906428 Lint (#8385) 2016-11-22 12:04:40 -08:00
Richard MaisanoandDan Abramov 501d25bf07 Add a couple missing SVG tags to DOM Elements docs (#8383)
My first contribution to React!

While upgrading a React project, I found some suspect SVG that needed updating, so I dug in after checking the docs. I knew that support for some SVG properties had been added (namely `xmlns` and `xmlnsXlink`), but I noticed them missing from the reference's attribute list. This pull request updates `reference-dom-elements.md` by adding said properties.
2016-11-22 18:50:11 +00:00
Ben AlpertandGitHub da1ad62881 Fiber: renderSubtreeIntoContainer (#8368) 2016-11-22 09:57:13 -08:00
Dan AbramovandGitHub 9e3ec6a4dd Revert "Stop relying on variable hoisting" (#8381) 2016-11-22 15:19:45 +00:00
Linus UnnebäckandDan Abramov 02f2811c00 Stop relying on variable hoisting (#8380)
Only declare the variable once in this scope, instead of declaring them multiple times in the same scope.

This fixes #8318, even though it might technically be a shortcoming in Rollup.
2016-11-22 15:18:10 +00:00
Mikhail OsherandDan Abramov e992f5cdfe Fix object spread operator (#8378)
Object spread operator performs shallow copy of object's arguments, so it should be placed before new properties are assigned.
2016-11-22 15:01:23 +00:00
Simen BekkhusandDan Abramov 7729a47841 Fix link to PureComponent in docs (#8375) 2016-11-22 11:09:07 +00:00
Robin RicardandDan Abramov ecc6f8c22d Change test assertion depending on a feature flag (#8306)
Instead of a private API (see https://github.com/facebook/react/pull/8150#discussion_r88280994)
2016-11-22 00:17:13 +00:00
Ben AlpertandGitHub 4ef522db23 Make findDOMNode generic (#8348) 2016-11-21 17:13:26 +00:00
Evan ScottandDan Abramov a42bb8f6ed Update all Jest packages to 17.x (#8327)
* Update all Jest packages to 17.x, cache babel-jest transforms

* Remove the caching

Looking at the other builds it doesn't seem to actually be that necessary.  The bottleneck is executors, not build time.

* Remove unnecessary package, fix fiber test runner

* Regenerate yarn lockfile
2016-11-20 16:10:08 +00:00
Michael SinovandDan Abramov 918706371c update react-without-es6.md (#8351) 2016-11-19 18:19:16 +00:00
Tom OcchinoandGitHub 095aad20d4 Move all dev *Hook tests and ComponentTreeTestUtils to expectDev (#8350) 2016-11-18 18:53:48 +00:00
Sebastian MarkbågeandGitHub b3c2dc0058 Fix ReactDOMFiberSelect to set the initial values (#8349)
I forgot that the normal properties route doesn't do this. We also have
to make sure that the order is 1) insert children (options), 2) set
multiple 3) update the options.
2016-11-18 18:52:15 +00:00
Sebastian MarkbågeandGitHub 79245ebeb4 Merge pull request #8347 from sebmarkbage/fiberdom
[Fiber] Handle controlled components
2016-11-18 18:35:26 +00:00
Dan AbramovandGitHub f53d4dd96c Merge pull request #8346 from shubheksha/docs/improve-state-and-lifecycle
Improved sections of state and lifecycle docs
2016-11-18 18:24:27 +00:00