Commit Graph
2815 Commits
Author SHA1 Message Date
Christopher Chedeau b0732ef881 [cleanup] Move ReactStateSetters inside of addons/link (#7085)
Summary:
The only callsite of ReactStateSetters is in LinkedStateMixin which lives in addons/link. Better move it there to avoid cluttering the other folder.

Test Plan:
None

Reviewers: @zpao @spicyj
2016-06-21 16:09:09 +02:00
Christopher Chedeau 489caeb2d7 [flow] type adler32 (#7080)
This one is trivial

Test Plan:
npm run flow

Reviewers: @zpao @spicyj
2016-06-20 15:35:59 +02:00
Christopher Chedeau 12a6ad1ef5 [flow] type KeyEscapeUtils (#7079)
Summary:

The only call site ensures that the value is not null: https://github.com/facebook/react/blob/dc6fc8cc0726458a14f0544a30514af208d0098b/src/shared/utils/traverseAllChildren.js#L44

key is stringified inside of createElement, so we are guaranteed to receive a string right now: https://github.com/facebook/react/blob/dc6fc8cc0726458a14f0544a30514af208d0098b/src/isomorphic/classic/element/ReactElement.js#L142

Test Plan:
npm run flow

Reviewers: @zpao @spicyj
2016-06-19 21:58:21 +02:00
Christopher Chedeau 5a21d49e3b Remove injectMixin (#6831)
Summary:
The only callsite left was removed here: https://github.com/facebook/react/commit/e8af100849932387643977587ccd7a4c1a981470#commitcomment-17570210 but the code to handle it remained.

Test Plan:
tbgs and ibgs, make sure there's no callsites.

Reviewers: @jimfb, @spicyj, @sebmarkbage
2016-06-19 21:57:27 +02:00
Christopher Chedeau 1c71970431 [flow] annotate accumulate and accumulateInto
Summary:
Trying to start adding flow types to files in React. I needed to add a script to package.json in order to run flow, flow-bin is already a dependency.

I had to rewrite the implementation a bit. Flow doesn't recognize

```
var currentIsArray = Array.isArray(current);
if (currentIsArray) {
  // not refined
}
```

but the following does work

```
if (Array.isArray(current)) {
  // refined
}
```

Test Plan:
npm run-script flow
npm run-script test accumulate

Reviewers: @zpao @spicyj
2016-06-16 17:33:32 +02:00
Jim 49238b9440 Warn if people mutate children. (#7001) 2016-06-15 22:22:31 -07:00
Toru Kobayashi e8fa464d6f Remove setProps and replaceProps from src (#7045) 2016-06-14 22:11:37 -07:00
Jim 97d89fa5bf Move null-input-value-prop warning into devtool, add stack trace (#7040) 2016-06-14 16:34:38 -07:00
Paul O’Shannessy 6e8c2fb828 Revert "Remove setProps and replaceProps completely" (#7039) 2016-06-14 15:02:01 -07:00
Christoph Pojer 6b8db0e111 Add symbol to identify a ReactTestComponent instance. (#7035) 2016-06-13 22:50:28 -07:00
Dominic Gannaway 40f6d3eaca Performance: setTextContent should attempt to set TextNode nodeValue where possible (#7005) 2016-06-10 09:57:31 -07:00
Jim 2282894d52 Remove console.log from test (#7006) 2016-06-09 09:24:03 -07:00
Jim 0bb0fe8d00 Fix controlled/uncontrolled validation for radio+checkbox inputs (#7003) 2016-06-09 07:58:42 -07:00
Toru Kobayashi 731e42998a Remove setProps and replaceProps completely (#6921) 2016-06-09 03:53:52 -07:00
Jim f0b140d726 Fix IE11 placeholder textContent value bug. (#7002) 2016-06-08 18:58:37 -07:00
Brandon Dail c47830d12c Warn if childContextType is defined on SFC (#6933)
Add console.error message content check

Use appropriate name in warning/test
2016-06-08 13:32:43 -07:00
Hiroyuki Wada 518336e2fb Fix #5839 Add error event to source element (#6941)
* Fix #5839 Add error event to source element

* Add test case for <source onError={callback}>
2016-06-08 13:30:27 -07:00
Josh Hunt 99d8524d23 Fix #6950, work around IE missing innerHTML on SVG nodes (#6982)
* Workaround IE lacking innerHTML on SVG elements

* Add tests for setInnerHTML

* Correctly check if node has innerHTML property

* Ensure tests for setInnerHTML actually tests both codepaths

* Provide mock element for setInnerHTML tests

* Only use SVG setInnerHTML workaround for SVG elements
2016-06-08 10:00:03 -07:00
Sebastian Markbåge 0cafd83834 Merge pull request #6988 from sebmarkbage/newreconciler
[Fiber] Minimize abuse of .alternate
2016-06-07 18:42:18 -07:00
Timothy Yung 7988acaa95 Improve error message for components in bad states (missing instance) (#6990) 2016-06-07 17:23:40 -07:00
Keyan Zhang 1abce1630c Add reactProdInvariant and corresponding babel rewrite pass (#6948) 2016-06-07 17:11:04 -07:00
Sebastian Markbage 40180c4b26 Get rid of ugly and difficult to follow breaks in switch
Because pattern matching or something.
2016-06-07 17:05:25 -07:00
Sebastian Markbage c83a0428f1 Minimize abuse of .alternate
This avoids using .alternate as much as possible and isolates it
to the root. For anything that is "work in progress" this happens
to be the same as the alternate field. To avoid an extra "current"
field on work in progress fibers, we can just use the alternate.

The timing for when this is true might be a bit tricky to reason
about so I explicitly pass the current value everywhere from the
top. That way we can always change this in the future to use an
explicit field or we can try to maintain a parallel data
structure that remembers which was the "current" fiber for each
wip child.
2016-06-07 15:03:32 -07:00
Sebastian Markbage 3a32d2642f Rename unitOfWork -> workInProgress
These values represent fibers that are incomplete. In the current
model they're mutated in place. In a completely immutable model
they would need to be cloned for every step they make progress.
I.e. one where the child is still in this WIP state and one when
it is complete.

To clarify this I'll name them workInProgress while they're in
that state, which is also what Jordan did in his prototype.
2016-06-07 13:49:12 -07:00
Sebastian Markbage cce58ffd62 Simple updates using alternate fibers
This splits the Fiber type into Fiber and Instance. This could be
two different object instances to save memory. However, to avoid
GC thrash I merge them into one.

When ReactChildFiber reconciles children, it clones the previous
fiber. This creates a new tree for work-in-progress. The idea is
that once flushed, this new tree will be used at the root.

However, we know that we'll never need more than two trees
at a time. Therefore my clone function stores the clone on the
original. Effectively this creates a fiber pool.

Ideally, the .alternate field shouldn't be used outside of clone
so that everything can work with pure immutability. I cheat a bit
for now so I don't have to pass both trees everywhere.

ReactChildFiber is a bit hacky for reuse and doesn't solve all
cases. Will fix that once I try to get parity.
2016-06-07 13:49:11 -07:00
Jim eb705d1448 Fix autofocus for input and textarea (#6986) 2016-06-07 12:50:37 -07:00
Dan Abramov d101f68bce Tweak ReactPerf warning message and code style (#6977) 2016-06-06 20:59:28 +02:00
Ben Alpert 8c60aaf430 Revert "Fallback to legacy set/get in old versions of FF" (#6976) 2016-06-06 11:49:43 -07:00
Alexander 2a46103ac8 Warn that ReactPerf does not work in the production build (#6884)
Fixes #6871
2016-06-06 20:46:57 +02:00
Dan Abramov afe483790b Revert "Warn that ReactPerf does not work in the production build (#6884, #6975)"
This reverts commit f71dfbcbf0.

Reverting because GitHub stripped the original PR author.
2016-06-06 19:44:40 +01:00
Dan Abramov f71dfbcbf0 Warn that ReactPerf does not work in the production build (#6884, #6975)
Fixes #6871
2016-06-06 20:37:46 +02:00
Ben Alpert 3c3c30a19a Fix function declaration in if statement (#6963)
Firefox doesn't like these and throws.
2016-06-04 13:37:57 -07:00
Keyan Zhang c9eb572a6f Fix null node issue in ReactCSSTransitionGroup (#6958) 2016-06-03 13:42:45 -07:00
Paul O’Shannessy dd093faadf Add <any> type args for ReactElement,Class,Component 2016-06-03 13:13:20 -07:00
Paul O’Shannessy 2efc7186fe Fix $FlowFixMe broken by comment spanning multiple lines 2016-06-03 13:13:19 -07:00
Andrew Imm 8216125d82 Fallback to legacy set/get in old versions of FF (#6930) 2016-06-02 11:35:21 -07:00
Sasha Aickin d6e70586b7 Replace the implementation of escapeTextContentForBrowser with escape-html (#6862)
* Replacing the implementation of escapeTextContentForBrowser with escape-html for performance

* Addressing @spicyj's code review comment here: https://github.com/facebook/react/pull/6862#issuecomment-223102868 . Pulled the code of escape-html in to react and changed the encoding of single quote to &#x27.

* Addressing code review comment https://github.com/facebook/react/pull/6862#discussion_r65462074 to make code more inlinable for v8. Thanks, @spicyj.
2016-06-01 17:14:30 -07:00
Ben Alpert 50982cea99 Add rudimentary test renderer (#6944) 2016-06-01 11:17:10 -07:00
Jim 51f8b1b40c Remove css px warning, stop appending px to strings (#6899) 2016-05-31 14:32:27 -07:00
Sebastian Markbage 8056fbc2c9 [Fiber] Simple test assertions
I'll split the coroutine and incremental testing into their own
tests so that I can expand them with more edge cases.
2016-05-31 13:52:28 -07:00
Sebastian Markbage 811084d74e Use the tag instead of stage field for coroutine stages
This gets rid of a field that we only need for coroutines.

We might need this if we have multi phase handlers in the future
but then maybe we can just use multiple tags.
2016-05-31 13:34:19 -07:00
Sebastian Markbage aa14d89c7d Transfer everything from Element onto the Fiber
This has a few benefits:

1) This allows the element to always remain on the young generation.
2) The key can be accessed on the fiber which is easier to keep as the
same class and is directly accessible in the child reconciliation of every
object.
3) This conveniently means that we don't have to create a fake element for
continuations which was really hacky.

We can still do the quick bailout of rerendered things using the props
object which is also unique.
2016-05-31 13:34:19 -07:00
Alex Jacobs 29ed7c6c8c Fix minor lint warnings (#6909) 2016-05-28 22:04:32 +01:00
Ben Alpert e62384bca4 Fix style test for Jasmine 2 (#6913) 2016-05-28 12:58:08 -07:00
Nate Norberg 38900cc7ca Added more specific warning for using onDblClick instead of onDoubleClick (#6881) 2016-05-27 15:23:05 -07:00
Jim ba3bfe3e31 Followup to 6896, add explanation of workaround. (#6905) 2016-05-27 09:19:25 -07:00
Paul O’Shannessy 5c6f9d31bd Merge pull request #6677 from zpao/dont-warn-css-0-string
Don't warn when style value is '0'
2016-05-26 20:05:32 -07:00
Sebastian Markbage fd4f74ef95 Coroutines 2016-05-26 18:13:21 -07:00
Sebastian Markbage 7c8a090994 Child Fiber 2016-05-26 17:27:19 -07:00
Robin Berjon 263615573c Stop passing null as second argument to document.createElement() (#6896)
* Stop passing null as second argument to document.createElement()

* rewrap check for props.is to make it more readable
2016-05-26 21:51:15 +01:00