Commit Graph
165 Commits
Author SHA1 Message Date
Ben AlpertandGitHub 64a7df5d6f Fix pull request detection on Circle 2016-12-07 13:45:06 -08:00
Ben AlpertandGitHub 1859e1251a Update facts-tracker for Circle (#8510) 2016-12-06 22:24:19 -08:00
Sebastian MarkbågeandGitHub de07c90204 Use Portals to test batching across roots (#8508)
This doesn't work by default in Fiber, you have to opt-in with a Portal to
get the explicit ordering guarantees.
2016-12-06 13:46:36 -08:00
Sebastian MarkbågeandGitHub 79731e09d2 Merge pull request #8450 from sebmarkbage/fiberfinddomnode
[Fiber] Fix findDOMNode and findAllInRenderedTree
2016-12-02 16:34:46 -08:00
Ben AlpertandGitHub 8a301f3eac Only upload build if server exists (#8488) 2016-12-02 14:31:17 -08:00
Tom OcchinoandBen Alpert efcc7a2210 Add circle.yml / CircleCI support (#8486) 2016-12-02 14:18:12 -08:00
Sebastian Markbage 5f8751c3b4 Fix findDOMNode and findAllInRenderedFiberTreeInternal
This strategy finds the current fiber. It traverses back up to the root if
the two trees are completely separate and determines which one is current.
If the two trees converge anywhere along the way, we assume that is the
current tree. We find the current child by searching the converged child
set.

This could fail if there's any way for both return pointers to point
backwards to the work in progress. I don't think there is but I could be
wrong.

This may also fail on coroutines where we have reparenting situations.
2016-12-01 21:21:05 -08:00
Sebastian Markbage 4b7ba0d7ee Additional findDOMNode tests
This is failing in Fiber without the fix. Because we have no deletions to rely
on in this case and the placement effects have already happened.
2016-12-01 21:03:24 -08:00
Ben AlpertandGitHub b3fd202762 Add test for unmount/remount in a single batch (#8470)
Fails in Fiber.
2016-12-01 14:19:00 -08:00
Ben AlpertandGitHub 859c33d927 Merge pull request #8463 from spicyj/travis
Update Travis config for new token
2016-11-30 21:03:01 -08:00
Ben Alpert 91015886ff Fix insecure shell escaping in facts tracker 2016-11-30 21:02:44 -08:00
Andrew ClarkandGitHub a84b647ef9 Clear existing text content before inserting children (#8331)
Fixes a bug when updating from a single text child (or
dangerouslySetInnerHTML) to regular children, where the previous
text content never gets deleted.
2016-11-30 18:08:41 -08:00
Ben Alpert 6ad98521de Update Travis config for new token 2016-11-30 17:17:04 -08:00
Andrew ClarkandGitHub a65ac28dba [Fiber] New error boundary semantics (#8304)
* Exit early in scheduleUpdate if a node's priority matches

This is a performance optimization and is unobservable. However, it
helps protect against regressions on the following invariants on which
it relies:

- The priority of a fiber is greater than or equal to the priority of
all its descendent fibers.
- If a tree has pending work priority, its root is scheduled.

* New error boundary semantics

- Recovering from an error boundary no longer uses Task priority by
default. The work is scheduled using whatever priority created the
error.
- Error handling is now a side-effect that happens during the
commit phase.
- The default behavior of an error boundary is to render null. Errors
do not propagate except when an boundary fails. Conceptually, this would
be like throwing an error from a catch block.
- A host container is treated like a no-op error boundary. The first
error captured by a host container is thrown at the end of the batch.
Like with normal error boundaries, the entire tree is unmounted.

* Fix broken setState callback test

* Add test for "unwinding" context when an error interrupts rendering

* Switch over primary effect types only

This avoids the need to create an export for every combination of bits.

* Only continue the work loop if the error was successfully captured

* Add more tests for incremental error handling

These tests are currently failing:

  ✕ catches render error in a boundary during partial deferred mounting
  ✕ catches render error in a boundary during animation mounting
  ✕ propagates an error from a noop error boundary during full deferred mounting
  ✕ propagates an error from a noop error boundary during partial deferred mounting
  ✕ propagates an error from a noop error boundary during animation mounting

The observed behavior is that unstable_handleError() unexpected gets called twice:

      "ErrorBoundary render success",
      "BrokenRender",
      "ErrorBoundary unstable_handleError",
  +   "ErrorBoundary render success",
  +   "BrokenRender",
  +   "ErrorBoundary unstable_handleError",
      "ErrorBoundary render error"

* Verify batched updates get scheduled despite errors

* Add try/catch/finally blocks around commit phase passes

We'll consolidate all these blocks in a future PR that refactors the
commit phase to be separate from the perform work loop.

* NoopBoundary -> RethrowBoundary

* Only throw uncaught error once there is no more work to perform

* Remove outdated comment

It was fixed in #8451.

* Record tests

* Always reset nextUnitOfWork on error

This is important so that the test at the end of performAndHandleErrors() knows it's safe to rethrow.

* Add a passing test for unmounting behavior on crashed tree

* Top-level errors

An error thrown from a host container should be "captured" by the host
container itself

* Remove outdated comment

* Separate Rethrow and Noop scenarios in boundary tests

* Move try block outside the commit loops
2016-11-30 16:54:20 -08:00
Ben AlpertandGitHub f268d18f73 Refs between fiber and stack (#8458)
I feel gross. Better ideas welcome.
2016-11-30 12:17:03 -08:00
Dan AbramovandGitHub 1d089a5241 Add tests for recovery from errors thrown in the reconciler (#8462)
Test that errors in the reconciler can be caught by error boundaries, and that we can still schedule updates if they are uncaught.
2016-11-30 17:00:14 +00:00
Dan AbramovandGitHub 6fa4dc8fbf [Fiber] Make bad element type message same as in Stack (#8460)
* Make bad element type message same as in Stack

This makes Fiber emit the same message as Stack (aside from the missing owner information).

* Add a separate test verifying error includes owner name

Fiber currently doesn't pass it. This is just to keep track of it as a todo.
2016-11-30 16:29:42 +00:00
Ben AlpertandGitHub a8a9a32b63 Fix reordering of bailed out children (#8457) 2016-11-29 14:57:04 -08:00
Ben AlpertandGitHub 014b51d3fb Fix fiber feature flag for ReactDOMProduction-test (#8451) 2016-11-28 23:36:05 -08:00
Ben AlpertandGitHub 95f573706e Add test for updating parent state in cWRP (#8448)
Fails in Fiber.
2016-11-28 19:05:24 -08:00
Ben AlpertandGitHub ba21f9e68b Fix context getting (#8407) 2016-11-28 18:33:46 -08:00
Dan AbramovandGitHub 629fb19ad3 [Fiber] Support iterables (#8446)
* Add iterable cases to MultiChildReconcile test

Stack currently supports rendering iterables, but Fiber does not.

Previously we didn't have any public API tests for iterables. We have tests for traverseAllChildren() which is shared between React.Children and Stack. However Fiber doesn't currently use it, and likely won't. So this commit is a first step towards actually testing iterable support via public API. The next step will be to port traverseAllChildren() tests to test React.Children API instead.

* Implement iterable reconciliation in Fiber

This uses the same exact algorithm as array reconciliation but uses iterator to step through.

This gets reconcile tests to pass again but introduces a regression in ReactMultiChildText case which uses Maps as children. It passed before because Maps were ignored, but now it's failing because this actually runs the Map code path in Fiber. We can throw early in this case when we want to follow up on this.

* Rewrite traverseAllChildren() tests against React.Children API

This function was used in React.Children and Stack.

The corresponding reconciliation functionality is being tested by ReactMultiChild tests.

So we can move these tests to ReactChildren and test its public API.
2016-11-28 23:44:56 +00:00
Ben AlpertandGitHub c1f77b1735 Use latest instance when restoring controlled state (#8443) 2016-11-28 14:00:50 -08:00
Ben AlpertandGitHub 1a41a8e732 Record tests (#8444) 2016-11-28 11:37:21 -08:00
Sebastian Markbage 3cc5b603b6 Move tests out of the Stack folder
So that we can share them with Fiber.

Also Server Rendering tests.
2016-11-28 10:55:28 -08:00
Brandon DailandDan Abramov 4c7a5e40f6 Use a closure to bind argument to callback in ReactErrorUtils (#8363)
* Use a closure to bind gaurded callback

This way the fake event isn't being implicitly passed into the event handler

* Add tests for ReactErrorUtils

Add fiber test report

Linting fixes
2016-11-28 16:54:57 +00:00
Christopher Chedeau 7fb4767158 test 2016-11-26 17:08:10 -08:00
Christopher Chedeau b9a3aff98f Do not forward stderr 2016-11-26 16:53:05 -08:00
Dan AbramovandGitHub d52ce87cbf Fix portal unmounting (#8422)
We used to terminate the search on host nodes, and then use the nested unmount algorithm.
However this means we didn't unmount portals inside the host nodes.

We will probably need to restructure this somehow but for now I just added a recursive call to unblock myself.
2016-11-25 21:43:56 +00:00
Dan AbramovandGitHub fdfb18907e Add a test for nested portals (#8416) 2016-11-24 18:43:45 +00:00
Sebastian MarkbågeandGitHub fed91f6018 [Fiber] Remove output field (#8406)
* Remove output field

The idea was originally that each fiber has a return value. In practice
most of what we're modelling here are void functions and we track side
effects instead of return values.

We do use this for coroutines to short cut access to terminal yields.
However, since this can be nested fragments we end up searching the tree
anyway. We also have to manage this in transferOutput so it ends up being
as expensive. Maybe we can save some traversal for updates when coroutine
branches bail out but meh.

* Unmount child from the first phase of a coroutine
2016-11-24 10:03:14 -08: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 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 baece8626f Re-record 2016-11-23 15:22:35 -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
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
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