Commit Graph

8703 Commits

Author SHA1 Message Date
Marcos Ojeda f737d63302 docs better indicate that state updaters shallowly merge with state (#9554)
this was a surprise to me because the docs seemed to indicate that when
using an updater, the result _needed_ to be a new state object. I was
[not alone](https://twitter.com/ken_wheeler/status/857939690191806464)
i think in discovering this as a result of the previous tweet in the
thread.
2017-04-30 17:40:22 -07:00
Ben Alpert f677bfc964 Fix __proto__ bug in ReactDOMSelect (#9536)
https://twitter.com/rauschma/status/857307345231249409
2017-04-29 08:23:00 -07:00
Sebastian Markbage 50d6f9656d Don't try to load asset manifest in dev mode
We're not going to use it so don't try to load it since it may not have
been built yet.
2017-04-27 21:57:01 -07:00
Sebastian Markbåge b9da1741cb SSR fixture (#9547)
Adds a server-rendering fixture based on create-react-app without ejecting.

This is using the full-page strategy because I wanted to flush out any issues with it. Turns out there's a lot of little things that are fixable and some non-fixable. This actually surfaced some differences between the current strategy and the one I had in mind.

This uses the asset manifest from webpack to pass the final URLs to the client. This ensures that we can render the same exact mark up on the client - including the URL to our own script that we're running in.

Doing full document renders work with 15.x as long as the checksum matches. However, with the patch up reviving strategy I had in mind it would end up removing the CSS tags that webpack injects before running our render call. This is a behavior change.

In dev mode the server runs a proxy in front of the normal CRA webpack server so that we can replace the HTML request for the root page.

I don't know what the best way to link in the react and react-dom packages. Each fixture has a different strategy so here's another one. Just add NODE_PATH=../../build/packages in front of all commands.
2017-04-27 21:03:32 -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
Sriram Thiagarajan 70c01963d9 pre format only compile time errors (#9538)
* pre format only compile time errors

* Style tweak
2017-04-27 11:49:34 +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
lamo2k123 48479438a3 Completely remove Object.prototype.hasOwnProperty.call() (#7853)
* Avoid directly calling hasOwnProperty

* correct use hasOwnProperty

* added eslint rules `no-prototype-builtins` http://eslint.org/docs/rules/no-prototype-builtins

* single style hasOwnProperty

* added file info /* global hasOwnProperty:true */

* added file info /* global hasOwnProperty:true */

* fixed no-prototype-builtins after merge

* yarn run prettier fixed

* remove src/addons

* return space after *

* remove /* global hasOwnProperty:true */

* Removed using Object.prototype.hasOwnProperty.call()

* yarn run prettier fixed

* Removed using Object.prototype.hasOwnProperty.call()
2017-04-26 20:30:38 +01:00
wacii 1816d06d6b Add guide on integrating with non-react code (#9316)
* Add guide on integrating with non-react code

* Capitalize guide title

* Make links to other docs relative

* Rephrase 'What it does do'

* Remove experimental syntax

* Capitalize Backbone

* Remove empty lifecycle method in generic jQuery example

* Use shouldComponentUpdate() not componentWillUpdate()

* Prefer single quotes

* Add cleanup to generic jQuery example

* Capitalize React

* Generalize the section on Backbone Views

* Generalize the section on Backbone Models, a little

* Add introduction

* Adjust wording

* Simplify ref callbacks

* Fix typo in generic jQuery example

* Fix typos in Backbone models in React components

* Fix more typos in Backbone models in React components

* Add generic section on integrating with other view libraries

* Stress the benefits of an unchanging React element

* Small changes to introduction

* Add missing semicolon

* Revise generic jQuery wrapper section

Moved the section on using empty elements to prevent conflicts above the
code example and added brief introduction to that example.

* Add usage example for Chosen wrapper

* Prevent Chosen wrapper from updating

* Note that sharing the DOM with plugins is not recommended

* Mention how React is used at Facebook

* Mention React event system in template rendering section

* Remove destructuring from function parameters

* Do not name React components Component

* Elaborate on unmountComponentAtNode()

* Mention preference for unidirectional data flow

* Rename backboneModelAdapter

* Replace rest syntax

* Respond to updated model in connectToBackboneModel

* Rewrite connectToBackboneModel example

* Rework connectToBackboneModel example

* Misc changes

* Misc changes

* Change wording

* Tweak some parts
2017-04-26 17:24:22 +01:00
RSG 9824d52a4c React.createElement syntax (#9459)
* React.createElement syntax

Added React.createElement syntax.
I think this is required for this tutorial.

* Reword
2017-04-26 14:25:40 +01:00
Tetsuya Hasegawa d6cc1d1755 Remove outdated Troubleshooting section (#9489)
* fixed a simple typo in README.md troubleshooting section

* Remove the troubleshooting section
2017-04-26 14:14:07 +01:00
Sriram Thiagarajan 7ccfb07337 fixed error formatting in live editor (#9497) 2017-04-26 14:06:53 +01:00
Daniel Lo Nigro cf24d87177 [site] Load libraries from unpkg (#9499)
* [site] Load libraries from unpkg

* Revert Gemfile changes
2017-04-26 14:02:50 +01:00
chocolateboy 3d60d4cc7d [Docs] Fix confusing description for the <script>...</script> usage (#9502)
* Fix confusing description for the <script>...</script> usage

* Update jsx-in-depth.md

* Update reference-react-dom-server.md

* Update reference-react-dom.md

* Update reference-react.md
2017-04-26 13:57:22 +01:00
Dmitri Zaitsev a8c223ab41 Add reference to the Hyperscript libraries (#9517)
* Add reference to the Hyperscript libraries

I feel these should be mentioned as they provide terser syntax than using `R.createElement` directly, even with a shorthand.

* Rephrase
2017-04-26 13:54:31 +01:00
Mateusz Burzyński dce3c28ccb Prevent process polyfill to be included in builds because of process guards preventing code replace (#9518) 2017-04-26 13:47:35 +01:00
Dominic Gannaway 71f201b5c3 updates yarn.lock (#9530) 2017-04-26 13:43:36 +01:00
Frankie Bagnardi 14fa8a5452 adds indirect refs to docs (#9528)
* adds indirect refs to docs

* Add more info

* Explain clearer

* Rephrase

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md

* Update refs-and-the-dom.md
2017-04-26 13:40:09 +01: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 81336fd8ce Prettier 2017-04-25 10:19:06 -07:00
Benedikt Meurer 0e587c1a8e Improve component type check in getComponentKey. (#9464)
* Improve component type check in getComponentKey.

The sequence
```
component && typeof component === 'object'
```
checks whether component is any JavaScript object except document.all.
Since document.all cannot occur here, this can be replaced with the
usual
```
typeof component === 'object' && component !== null
```
sequence, which yields true for all JavaScript objects and is well
optimized by all JavaScript engines.

* Run yarn prettier.
2017-04-25 09:39:30 -07:00
Nathan Hunzaker a9d0deb8e1 Consolidate events between EventConstants and BrowserEventEmitter (#9512) 2017-04-25 09:24:10 -07:00
Maciej Kasprzyk d12c41c7a6 Describe fixtures dir in the codebase overview (#9516)
* Describe fixtures dir in overview

* Fix folder name
2017-04-25 10:25:32 +01: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
Andrew Clark 4cbadd3fb6 Prettier 2017-04-24 17:19:38 -07:00
Andrew Clark b61f060044 ReactARTStack should use ReactDOM's ReactUpdates (#9515) 2017-04-24 17:03:12 -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
Jen Wong c8a64e2637 Updates how-to-contribute.md to use JSFiddle referenced in submit Git issue template (#9503) 2017-04-23 18:03:11 -05:00
Paul O’Shannessy bcb6f0eac4 Don't build gh-pages branch on CircleCI (#9442) 2017-04-22 22:33:43 +01:00
Flarnie Marchan 39ca8aacf8 Add link to 'Typechecking with PropTypes' under 'Advanced Guides' (#9472)
This should have been retained in our docs, since PropTypes are only
moved and not deprecated.

Partially handles #9467, and I'll make a separate PR to
https://github.com/reactjs/prop-types to add more docs to the README
there.
2017-04-22 10:41:39 -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
Roman Matusevich 6dfb65a121 Remove Prev Next links from add-ons documentation (#9226) 2017-04-21 15:31:17 +01:00
David Hu f5144121f9 Add more details in jsx-in-depth.md (#9006)
* jsx-in-depth.md add ternary statement for javascript expressions section

* jsx-in-depth.md add explanation to get falsey values for props

* update jsx-in-depth.md

* ensure links work locally, remove section about falsey prop values

* Fix links
2017-04-21 15:27:39 +01:00
Benton Rochester 217d271032 Ignoring files for vim users. (#9199) 2017-04-21 15:25:34 +01: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
Brian Vaughn 41290742e6 Bumped version numbers for alpha 10 (#9474) 2017-04-20 13:06:51 -07:00
Brian Vaughn 73ca89408b Updated PropTypes test to work with newer prop-types version (#9471)
The prop-types lib got an anti-spamming change in 15.5.8 that broke some of our tests (see reactjs/prop-types/commit/e1d51dd0efbd0eee5e4a8d24759f2a4d518721d3). This PR resolves that by resetting the prop-types import between tests.
2017-04-20 12:48:53 -07:00
Andrew Clark 28bc8860bc Run prettier after update to 1.2 in master 2017-04-20 11:39:04 -07: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 488b973d68 Use number type for bitfields
Unions don't enumerate all the possible combinations of bitfields. I'm
not actually sure why this was type-checking before.

number doesn't provide much safety but it's more correct.
2017-04-20 11:38:13 -07:00
Andrew Clark f69748601d Remove unstable_asyncRender() API in favor of always using a wrapper 2017-04-20 11:38:13 -07:00
Andrew Clark abd07dffb3 Rename contextTag -> internalContextTag 2017-04-20 11:38:13 -07:00