Commit Graph
8520 Commits
Author SHA1 Message Date
Brian VaughnandGitHub a0cb40f8fa Stop passing prevContext param to componentDidUpdate (#8631) 2017-04-21 13:15:22 -07:00
Soo Jae HwangandBrandon Dail 82dd4cfe4a [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 NikamandBrandon Dail 2ccc018979 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 PotapovandBrandon Dail 9cc170d188 Warn about Infinity in style value (#9360)
* warn about Infinity in style value

* prettier
2017-04-21 09:41:43 -05:00
Roman MatusevichandDan Abramov ae43ad37cf Remove Prev Next links from add-ons documentation (#9226) 2017-04-21 15:31:17 +01:00
David HuandDan Abramov 1cad3ddd97 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 RochesterandDan Abramov 50c3f5e417 Ignoring files for vim users. (#9199) 2017-04-21 15:25:34 +01:00
Brandon DailandGitHub 41f5554874 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 VaughnandGitHub 0dc29e73c4 Bumped version numbers for alpha 10 (#9474) 2017-04-20 13:06:51 -07:00
Brian VaughnandGitHub 61dd7b4292 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 05f985bb8c Run prettier after update to 1.2 in master 2017-04-20 11:39:04 -07:00
Andrew Clark 1eec6694ae Fix subtree tests so that async component is not top-level 2017-04-20 11:38:13 -07:00
Andrew Clark 780c5a081c 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 dfb5fb2089 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 5462acef35 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 6b2d3652a4 Remove unstable_asyncRender() API in favor of always using a wrapper 2017-04-20 11:38:13 -07:00
Andrew Clark e6709953b3 Rename contextTag -> internalContextTag 2017-04-20 11:38:13 -07:00
Andrew Clark 92ac2e1541 Add enableAsyncSubtreeAPI to host config
Allows us to control this feature on a per-renderer basis
2017-04-20 11:37:18 -07:00
Andrew Clark 46fc08dad5 Run Fiber test script 2017-04-20 11:37:18 -07:00
Andrew Clark 6cb2e5533e Run prettier 2017-04-20 11:37:18 -07:00
Andrew Clark 98e86c791f instance.unstable_asyncUpdates = true creates an async subtree
Same behavior as unstable_asyncRender. Can be used to wrap a specific
subtree, rather than an entire root.
2017-04-20 11:37:18 -07:00
Andrew Clark 2ae28310bf ReactDOM.unstable_asyncRender creates an async-by-default tree
The default priority of updates in a async tree is LowPriority, rather
than SynchronousPriority.

Warns if you call unstable_asyncRender on a tree that was created with
the normal, sync ReactDOM.render.
2017-04-20 11:37:18 -07:00
Andrew Clark c31435f7ae Use different default priority depending on the AsyncUpdate context flag
- A priority context of NoWork represents the default priority
- Changed the signature of getPriorityContext to accept the fiber that
is about to be updated.
2017-04-20 11:36:35 -07:00
Andrew Clark 52457072d4 Inherit contextTag from the parent on creation
A fiber has all the context flags of its parent. It may also add
additional ones during construction/mount. After mounting, contextTag
shouldn't change.
2017-04-20 11:35:08 -07:00
Andrew Clark 79ef0e6541 Add contextTag field to Fiber type
contextTag is a bitmask that describes properties about the fiber
and its subtree. For example, the AsyncUpdates flag indicates whether
the subtree should use async scheduling.

When a fiber is created, it inherits the bitmask of its parent.
2017-04-20 11:35:08 -07:00
Eric SakmarandFlarnie Marchan e2c60c5def Adds CSS Grid properties to list of unitless numbers (#9185) 2017-04-20 11:20:15 -07:00
Ben AlpertandGitHub 9f565dc060 Prettier 1.2 (#9462) 2017-04-20 11:18:33 -07:00
Ben AlpertandGitHub 53eb8de1d5 Add component stack to invalid-object-child error (#9415)
https://twitter.com/EsaMatti/status/835952325525188608 (28 likes!)
2017-04-20 09:49:46 -07:00
Dan Abramov f07dcf6f03 Bump prop-types 2017-04-20 16:40:58 +01:00
Almero SteynandDan Abramov 5e36ff2cdf [Docs: Installation] Fix tabs responsive layout - Resubmit (#9458)
* [Docs: Installation] Fix tabs responsive layout

* Move tabs a pixel down

* Remove left margin on first tab

* Remove the long line

* Fix mobile styles
2017-04-20 11:49:48 +01:00
Brian Vaughn ac8f2abe90 Fix master (ran prettier) 2017-04-19 19:03:04 -07:00
Brian VaughnandGitHub a8496401db 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
Ben AlpertandGitHub 1b11144873 Uncomment invariant in UIManager mock (#9461) 2017-04-19 16:28:59 -07:00
Brian VaughnandGitHub f647682840 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 MarchanandGitHub c3e92fd171 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
Almero SteynandDan Abramov c476542661 [Docs] Add accessibility to tabs in installation documentation (#9431)
* Add accessibility to tabs in installation documentation

* Change color and fix styling
2017-04-19 12:31:39 +01:00
Joel DenningandDan Abramov d3f84edcb6 Fixing the instantiation of customized builtin elements (related to custom elements) (#9313)
* Fixing the creation of customized builtin elements

* Whitespace

* Running prettier

* Updating ReactDOMFiberComponent
2017-04-19 12:07:16 +01:00
Fabrizio CastellarinandDan Abramov ff7baa4c95 Reorganize the "following along" instructions (#9453)
* Reorganize the "following along" instructions

* Minor tweaks
2017-04-19 12:00:15 +01:00
Ben AlpertandGitHub 55eeb6c403 Fix errors in React Native children management (#9449)
* Fix errors in React Native children management

- Support using appendChild to move an existing child (Fiber does this, but we were assuming all children here were new; Yoga throws if you insert a child that already has a parent)
- Calculate beforeChildIndex after removing old child (previously, off by one when the new position is later than the old position)

* Add better children management tests for RN
2017-04-18 17:31:33 -07:00
Filip HoškoandDan Abramov ab483f49df FIX: Move CRA build info under it's tab page (#9452)
* FIX: Move CRA build info under it's tab page

* Add some links
2017-04-18 18:17:28 +01:00
Dan Abramov a7e7e5054b Tweak tutorial structure 2017-04-18 18:07:16 +01:00
Dan Abramov 8e861af293 Add missing tutorial sidebar links 2017-04-18 18:00:54 +01:00
Dan Abramov 8798c9f08b Minor tutorial nits 2017-04-18 17:53:53 +01:00
Dan Abramov b97d51af57 Fix duplicate sentence 2017-04-18 17:44:32 +01:00
Dan AbramovandGitHub 7415729e55 Minor tweaks to tutorial 2017-04-18 17:40:59 +01:00
Frankie BagnardiandDan Abramov e2846ee6d0 [Tutorial] ES6, installation, and button closing tag (#9441)
* adds notes to tutorial on es6 and installation

* fixes tutorial mention of opening button tag

* More writing

* Update
2017-04-18 17:34:43 +01:00
Abhishek SoniandDan Abramov 70ebda7630 Fixed grammar (#9432)
* Update codebase-overview.md

* Some more fixes
2017-04-18 16:38:39 +01:00
hanumanthanandDan Abramov 5689096e92 Lift state up - Updating the documentation to mention that onClick is a synthetic event handler (#9427)
* Lift state up - Updating the documentation to mention that onClick is a synthetic event handler

* Review comments - Rephrase to handle synthetic events and event handler patterns

* Tweak
2017-04-18 16:27:45 +01:00
Michał OrdonandDan Abramov 8a54de60c8 Sort out conferences by date (#9172) 2017-04-18 15:38:19 +01:00
Jayen AsharandDan Abramov b292ccc940 Update jsx-in-depth.md (#9178)
* Update jsx-in-depth.md

Line 9 isn't changed

* Move selection down

* Fix
2017-04-18 15:29:17 +01:00