Commit Graph

425 Commits

Author SHA1 Message Date
Dominic Gannaway
a7d8ebd2b5 Add React benchmarking infrastructure (#9465)
* Initial commit for WIP benchmarking infrastructure

* fixed lint issues and ran prettier

* added <rootDir>/scripts/bench/ to ignore paths for Jest

* tidied up code and fixed a few bugs in the runner.js

* fixed eslint

* improved the benchmark output from the runner

* fixed typo

* tided up print output in runner.js

* throw error if chrome canary is not installed on mac

* added better bench stats output (tables)

* added benchmark diff to table results

* adds bundle size comparisons to results

* tidied up the results

* fixed prettier output

* attempt to trigger bech for circleci build

* fixes flow exlclusion for lighthouse module

* added class components benchmark

* cleaned up stats.js

* stability changes

* circleci node version to 7

* added another benchmark

* added colours to the different benchmarks to check if being cached

* force no-cache headers

* added more info messages

* refactor chrome launching.

* fixed an issue where launcher.kill might fail

* Move server to runner. Launch it only once.

* tidy up

* changes the logic in how the remote repo is checked out

* removes bench from circleci build

* removed colors from benchmarks (no longer needed)

* added CI integration comment

* added hacker news benchmark

* added skipBuild functionality

* relabelled remote

* Add confidence intervals

* added first meaningful paint

* removed some unused code

* reverted code.json

* updated benchmark runs back to 10

* no longer breaks when results contain missing bundles

* adds CPU throttling

* renamed build to remote-repo

* small fix to build

* fixed bad merge

* upped runs to 10 from 2 again

* properly pulls master

* removes old-bench

* runs benchmarks in headless mode

* adds a --headless option

* improved the git build process

* added README

* updated based feedback from review

* adds merge base commit sha

* addressing more PR feedback

* remove built JS react files

* updated .gitignore

* added combined bundle load times to the metrics
2017-05-09 17:13:54 +01:00
Ben Alpert
542dac4a23 Fix return value of ReactDOMFiber.unmountComponentAtNode (#9619) 2017-05-05 17:54:53 -07:00
Andrew Clark
628b82c808 Allow assigning to this.state inside componentWillMount, with a warning 2017-05-05 14:03:29 -07:00
Andrew Clark
1232666590 Don't recreate instance when resuming a class component's initial mount
Recreating the class instance causes refs (and other callbacks) to close
over stale instances.

Instead, re-use the previous instance. componentWillMount is called
again. We also call componentWillReceiveProps, to ensure that
state derived from props remains in sync.
2017-05-05 14:03:29 -07:00
Nathan Hunzaker
6875fa867f Remove loose check on non-number controlled inputs. Fix trailing dot issue. (#9584)
* Remove loose check when assigning non-number inputs

This commit removes a check I added when working on number input
issues where we perform a loose check on an input's value before we
assign it. This prevented controlled text inputs from disallowing
numeric text entry.

I also added a DOM fixture text case.

Related issues:

https://github.com/facebook/react/issues/9561#issuecomment-298394312

* Use strict equality as a guard before assigning input.value

This commit adds back the guard around assigning the value property to
an input, however it does it using a strict equals. This prevents
validated inputs, like emails and urls from losing the cursor
position.

It also adds associated test fixtures.

* Add copy command after build for interup with surge.sh
2017-05-03 13:37:56 -05:00
Andrew Clark
535afaf759 16.0.0-alpha.12 2017-05-02 14:26:42 -07:00
Dan Abramov
45dbcfb67d Add missing passing test 2017-05-02 14:22:09 +01:00
Ben Alpert
f677bfc964 Fix __proto__ bug in ReactDOMSelect (#9536)
https://twitter.com/rauschma/status/857307345231249409
2017-04-29 08:23:00 -07:00
Manas
182642b2ea Fiber ReactDOM shouldn't throw on import in Node environment if it's unused (#9389)
* Fixes #9102 by fake polyfilling rAF (and rIC)

* Ensure we restore globals even if test fails + minor nits

* Remove periods
2017-04-27 13:13:03 +01:00
Andrew Clark
0e3280e2c6 includes -> indexOf 2017-04-26 18:10:27 -07:00
Andrew Clark
1fd582ba20 Fix unnecessary ReactDOM require (#9534)
Apparently, when you mark something as external in Rollup, a require
statement is inserted even if the module isn't used. This is causing
ReactDOM and several other modules to be inserted unnecessarily.

We need a better fix for this, but I'm pushing this quick fix for
now since it's blocking sync to www.
2017-04-26 18:07:53 -07:00
Andrew Clark
8ba820a699 Use prop-types instead of prop-types factory (#9526)
Latest versions of prop-types don't depend on React, so the factory is
not necessary, and in fact bloats the build because it is intended for
15.5 and so doesn't strip out the checkers in prod.
2017-04-25 14:32:27 -07:00
Andrew Clark
09a9c646fd Rename react-dom to ReactDOM in Facebook www (#9525) 2017-04-25 13:30:48 -07:00
Brian Vaughn
2905e56904 Bumped version numbers and built 16.0.0-alpha.11 2017-04-24 18:52:10 -07:00
Brian Vaughn
e71b3087c8 Added stack renderer to react-test-renderer bundle temporarily (#9514)
Also fixed an error in a temporary export property that had been added to the React object
2017-04-24 18:45:43 -07:00
Nathan Hunzaker
86dd083f45 Move ReactDOMFactories into separate package (#8356)
- Update examples to no longer use React.DOM
- Add package and documentation entries for react-addons-dom-factories
- Update dom-factories readme
- Set up proxy to intercept React.DOM usage
- Update ReactDOM children tests to use createElement
- Add more specific warning assertion for React DOM factories
- Do not use expectDev in ReactDOMFactories tests
2017-04-24 08:08:17 -07:00
Brian Vaughn
9d225b5a44 Stop passing prevContext param to componentDidUpdate (#8631) 2017-04-21 13:15:22 -07:00
Soo Jae Hwang
ec527cc834 [WIP] Warn in dev if shouldComponentUpdate is defined on PureComponent (#9240)
* Add test for React.PureComponent

* Add warning when shouldComponentUpdate is declared in a PureComponent

* Add actionable warning

* Add warning in Fiber

* Format added code by running yarn prettier

* Move pure sCU check to checkClassInstance

That way it warns before the component updates
2017-04-21 09:55:16 -05:00
Abhay Nikam
5518bd44a9 Warning added if defaultProps were defined as an instance property (#9433)
* Added warning when defaultProps was defined as an instance property

* Added testcases to check warning message for defaultProps

* Update fiber tests
2017-04-21 09:46:19 -05:00
Vitaliy Potapov
895dca587b Warn about Infinity in style value (#9360)
* warn about Infinity in style value

* prettier
2017-04-21 09:41:43 -05:00
Brandon Dail
42bc28bbfd Use setProperty when setting style properties (#9302)
* Use setProperty when setting style properties

setProperty is faster in all/most modern browsers. It also lets us support CSS variables.

* Only use setProperty when setting CSS variables

* Add test to ensure setting CSS variables do not warn

* Make this PR pretty again

* Run fiber test script
2017-04-20 15:25:39 -05:00
Andrew Clark
b4d77b98ed Fix subtree tests so that async component is not top-level 2017-04-20 11:38:13 -07:00
Andrew Clark
9b676a7d0b Remove enableAsyncSubtreeAPI from host config
Use a ReactFeatureFlag instead. It won't be per-renderer, but we likely
won't need that.

When enableAsyncSubtreeAPI is false, unstable_asyncUpdates is ignored,
but does not warn or throw. That way if we discover a bug in async mode,
we can flip the flag and revert back to sync without code changes.
2017-04-20 11:38:13 -07:00
Andrew Clark
0c896ffe6b Change unstable_asyncUpdates from an instance to a static property
This lets us check for its existence before the instance is constructed.

Also works with functional components.
2017-04-20 11:38:13 -07:00
Andrew Clark
864973c544 Run Fiber test script 2017-04-20 11:37:18 -07:00
Ben Alpert
b1768b5a48 Prettier 1.2 (#9462) 2017-04-20 11:18:33 -07:00
Brian Vaughn
66f2097f33 Shallow renderer and test utils bundles (#9426)
Shallow renderer and test utils bundles

Adds new bundles introduced with React 15.5 release to master (and 16 alpha)

react-dom/test-utils:

This new bundle contains what used to be react-addons-test-utils. This bundle shares things from react-dom rather than duplicates them.

A temporary createRenderer method has been left behind as a way to access the new shallow renderer. This is for the ReactNative release cycle only and should be going away before the final release.

react-test-renderer/shallow:

This new shallow renderer is almost entirely stand-alone (in that it doesn't use the React reconciler or scheduler). The only touch points are ReactElement and prop/context validation. This renderer is stack and fiber compatible.
2017-04-19 16:45:31 -07:00
Brian Vaughn
8782ab759e Fix CI failures in master (#9455)
* Ran prettier over UIManager mock
* Temporarily disabled an invariant() in UIManager mock that was breaking tests
* Updated Fiber passing tests
2017-04-19 08:59:40 -07:00
Flarnie Marchan
3e48422fdc Warn for keys in fragments - third approach (#9445)
* Fix tests to pass when we warn for missing keys in fragments

In most cases we just needed to add the 'key' prop.

This ignores the tests which are already failing on master when running
with ` REACT_DOM_JEST_USE_FIBER=1` - there are 8.

All tests should now pass with `npm run test`, and the 8 which fail when
running `REACT_DOM_JEST_USE_FIBER=1 npm run test` are the same 8 which
are failing on master.

* Added missing key warning for children in array fragments

After trying twice to reuse the code between the ReactChildFiber and
ReactElementValidator, I am thinking that it's simpler to just have some
duplication of code. The parts that are shared are interleaved with
parts which cannot be shared, either because of singleton modules that
must be required differently in 'isomorphic' and the 'renderers', or the
fact that 'warning' requires a hard coded string.

Test Plan:

- Added test to ReactChildren-test
- Manually tested via fixture that was not committed.

* commit updated "scripts/rollup/results.json"

* Make 'ReactChildren-test' more specific, and remove unneeded nesting

Based on helpful tips from @spicyj and @aweary's review
 - Made the unit test for the warning on missing keys more specific
 - Removed unneeded nesting in the code which generates missing key
   warning
 - Change test syntax to use JSX to be more consistent

Also fixes flow warning.

* Commit update of scripts/rollup/results.json

* run "scripts/fiber/record-tests"
2017-04-19 08:05:04 -07:00
Arshabh Kumar Agarwal
f54fdd5441 Add warning if rendering and HTMLUnknownElement (#9163)
* Add warning if rendering and HTMLUnknownElement

* Records fiber tests

* Fixes linting and server render tests

* Incorporates review comments

* Uses ownerDocument instead of document

* uses el instead of creating a new element

* Removes warning check of voidElementTags

* Add missing space to unknown element warning

* Only call isCustomComponent once

* Spy on console in menuitem test

Since menuitem is treated as an unknown element in jsdom it triggers the unknown element warning.

* Add unknown element warning to Fiber

* Replace instanceof with toString check

It is more resilient.

* Record tests
2017-04-14 11:30:38 -05:00
Brian Vaughn
6cd7618bd7 Bumped versions for 16.0.0-alpha.9 and re-built 2017-04-11 14:40:56 -07:00
Brian Vaughn
2beec2f308 createClass + PropTypes + checkPropTypes warnings (#9399)
(Temporarily) re-adds getters with deprecation warnings for React.PropTypes, React.checkPropTypes, and React.createClass.

* 08bd020: Replace all references to React.PropTypes with prop-types to avoid triggering our own warning message.
* ef5b5c6: Removed several references to React.createClass that appeared after rebasing this branch. (reviewed by @flarnie)
* 524ce20: Added getters for createClass and PropTypes to the main React isomorphic object, behind one-time warning messages. (reviewed by @spicyj)
* db48f54: Fixed Rollup bundles to inline 'prop-types' and 'create-react-class' for UMD builds only. (reviewed by @spicyj, @trueadm )
* cf49cfd: Updated tests-passing.txt to remove tests that were deleted in this branch.
* d34109a: Responses to PR feedback from @spicyj. (Added package.json dependencies to packages/react and packages/react-dom. Renamed a var. Expanded on an inline comment.)
* 488c8d2: Added warning for moved package to React.checkPropTypes accessor too and updated build script.
* 83bcb29: Wordsmithing for deprecation notices (added fb.me links).
* afdc9d2: Tweaked legacy module inlining to remove order-of-deps constraint
* d1348b9: Removed $FlowFixMe.
* 7dbc3e7: More wordsmithing of deprecation notices based on Dan's feedback.
2017-04-11 14:28:03 -07:00
Andrew Clark
957fbc92b1 react-create-class -> create-react-class 2017-04-10 17:06:32 -07:00
Andrew Clark
ce489262a1 Add react-create-class integration tests
These are mostly copied from the old ReactClass-test module.
2017-04-10 17:03:05 -07:00
Andrew Clark
646e786334 Warn once when attempting to access React.createClass
Should still be undefined.
2017-04-10 17:03:05 -07:00
Andrew Clark
c76a4eaa2a Update tests to use plain JavaScript classes
Tests that rely on replaceState or isMounted use
updater.enqueueReplaceState and updater.isMounted instead.
2017-04-10 17:03:05 -07:00
Dan Abramov
457b812c26 Fix ReactARTStack bundles to not include DOM Stack inside (#9394)
* Move ReactDOMFrameScheduling.js to shared (between dom and art)

* Fix ReactARTStack bundles to not include DOM Stack inside
2017-04-10 22:01:56 +01:00
Dan Abramov
72196da829 Replace shims with explicit React access from the renderers for shared global state (#9366)
* Remove non-existent /lib/ from souce files

* Replace all shims with explicit access

This deletes shims and changes to access require('react').__DO_NOT_USE__ from renderers for global shared state.

I cloned flattenChildren() and traverseAllChildren() because they relied on CurrentOwner but were used both from Stack and Isomorphic. The stack implementations will die, and the isomorphic ones can be changed to be optimized for Children specifically in the future.

I also deleted UMD shims because they are now unnecessary. I moved the internals assignment to main modules since they're now used in tests, and made them direct UMD entry points.
2017-04-07 22:07:10 +01:00
Dan Abramov
d88696941d 16.0.0-alpha.8 2017-04-07 18:47:23 +01:00
Dan Abramov
d9fd08df26 Make ReactDebugCurrentFrame shared state between core and renderers (#9365) 2017-04-07 17:03:22 +01:00
Dan Abramov
e303e00d06 Tweak Rollup setup (#9364)
* Remove unused Rollup shim and exports

* Add a way to build multiple bundles
2017-04-07 16:17:36 +01:00
Dan Abramov
21bb8c00d4 16.0.0-alpha.7 2017-04-06 19:50:22 +01:00
Dominic Gannaway
832488ab09 change permissions of test_print_warnings (#9347) 2017-04-05 23:18:39 +01:00
Dominic Gannaway
3ebdd0911e Fixes the eager react-dom replacement on the rollup plugin (#9346)
* Fixes the eager react-dom replacement on the rollup plugin

* added the other replaceInternalModules
2017-04-05 22:42:12 +01:00
Dan Abramov
3a416762e7 Fix glob ignore for build script 2017-04-05 20:24:30 +01:00
Dan Abramov
6a48f32f21 Exclude tests from warning print script 2017-04-05 19:51:19 +01:00
Dan Abramov
fc1f324cc4 Fix warnings script to work on Node 4 2017-04-05 19:01:09 +01:00
Dan Abramov
398d449c48 Fix the print warnings script (#9344) 2017-04-05 18:54:48 +01:00
Dominic Gannaway
6b68410808 Adds support for labels on building bundles (#9342)
* adds support for labels on bundles

* -fiber

* reverts results
2017-04-05 18:30:12 +01:00
Dominic Gannaway
24dc43c49f fixes circleci/upload_build.sh paths for dist files (#9341)
* fixes circleci/upload_build.sh paths for dist files

* updated the react filenames to include development or production
2017-04-05 17:25:09 +01:00