Commit Graph

9309 Commits

Author SHA1 Message Date
Dan Abramov 6ad203630b
Add a link to RCR explanation 2017-11-03 00:47:54 +00:00
Dan Abramov 73bb99626f
Update changelog 2017-11-03 00:45:22 +00:00
Brian Vaughn 1298e15f84 Update bundle sizes for 16.1.0-beta release 2017-11-02 15:34:31 -07:00
Brian Vaughn 8306553301 Update error codes for 16.1.0-beta release 2017-11-02 15:34:31 -07:00
Brian Vaughn 00e27eaf1e Updating package versions for release 16.1.0-beta 2017-11-02 15:32:36 -07:00
Brian Vaughn c5c48b51b4 Updating yarn.lock file for 16.1.0-beta release 2017-11-02 15:31:08 -07:00
Brian Vaughn a181ba8707
Auto-install (or update) release script Yarn deps before running (#11434) 2017-11-02 15:21:28 -07:00
Clement Hoang 1e35f2b282 Put createRoot export under a feature flag (#11426) 2017-11-02 15:21:06 -07:00
Dan Abramov 45c1ff348e
Remove unnecessary 'use strict' in the source (#11433)
* Remove use strict from ES modules

* Delete unused file

This was unused since Stack.
2017-11-02 20:32:48 +00:00
Dan Abramov c0ee8df26c Record sizes 2017-11-02 19:54:58 +00:00
Dan Abramov 21d0c11523
Convert the Source to ES Modules (#11389)
* Update transforms to handle ES modules

* Update Jest to handle ES modules

* Convert react package to ES modules

* Convert react-art package to ES Modules

* Convert react-call-return package to ES Modules

* Convert react-test-renderer package to ES Modules

* Convert react-cs-renderer package to ES Modules

* Convert react-rt-renderer package to ES Modules

* Convert react-noop-renderer package to ES Modules

* Convert react-dom/server to ES modules

* Convert react-dom/{client,events,test-utils} to ES modules

* Convert react-dom/shared to ES modules

* Convert react-native-renderer to ES modules

* Convert react-reconciler to ES modules

* Convert events to ES modules

* Convert shared to ES modules

* Remove CommonJS support from transforms

* Move ReactDOMFB entry point code into react-dom/src

This is clearer because we can use ES imports in it.

* Fix Rollup shim configuration to work with ESM

* Fix incorrect comment

* Exclude external imports without side effects

* Fix ReactDOM FB build

* Remove TODOs I don’t intend to fix yet
2017-11-02 19:50:03 +00:00
Dan Abramov fbf617a263
Update Rollup (#11427)
* Update Rollup

* Strip "use strict" in individual modules

* Record sizes
2017-11-02 16:56:12 +00:00
Dan Abramov f302a6a334 Record sizes 2017-11-02 16:26:54 +00:00
Dan Abramov 4008f6d37d
Validate built bundles with a few ESLint rules (#11432) 2017-11-02 15:50:25 +00:00
Dan Abramov b98313f176 Fix lint issues 2017-11-02 14:07:20 +00:00
Dan Abramov c97c92061b
Undo fbjs/lib/EventListener inlining (#11431) 2017-11-02 13:43:28 +00:00
Dan Abramov 983ec90764
Always run React.Fragment tests (#11430) 2017-11-02 13:31:17 +00:00
Dean Brophy 787c2ad2d9 Constructor error message (#11395)
* Constructor test and fix complete

* Linters and prettier run

* Remove unnecessary checks

* Update error message

* Updat unit test

* prettier

* Tweak the check to be more specific

* Move tests to ReactCompositeComponent-test

* add error call count and remove line
2017-11-01 21:01:24 +00:00
Dan Abramov 9d75a62d14
Depend on prop-types/checkPropTypes, not prop-types itself (#11420)
* Remove prop-types/checkPropTypes reimplementation

* Remove renderer dependency on top-level PropTypes

This annotation is unnecessary because we already warn for bad event listener types.

* Record sizes
2017-11-01 10:57:24 +00:00
Clement Hoang 0e15ff5669
Put React.Fragment under a feature flag (#11421)
* Put React.Fragment under a feature flag

* Don't export undefined Fragment
2017-10-31 17:43:55 -07:00
Dan Abramov dd1b7afc14
Use warning() over console.error() direct call (#11418) 2017-11-01 00:41:02 +00:00
Dan Abramov 9f2b15909a Record sizes 2017-10-31 22:14:22 +00:00
Sebastian Markbåge 2c1ac9fe1d
Inline fbjs/lib/EventListener dependency (#11402)
* Drop fbjs/lib/EventListener from tests

Assert on the underlying native event listener instead.

This test file still needs to be rewritten in terms of public APIs.

* Inline fbjs/lib/EventListener dependency

We explicitly don't want to shim this and we don't use the return value.

We can probably even drop the IE path now since we don't support it.
Not sure if that'll be a true breaking change though.

* Wrap event listeners and the callback passed to requestIdleCallback

This is a FBism.

This uses the injection model in ReactErrorUtils. This isn't technically
going to used for errors but close enough.

This really wants to be eager but we can't because of dynamic injection.
2017-10-31 11:23:03 -07:00
Matteo Vesprini-Heidrich 0752a63f59 add Portal support to React.Children calls (#11378) 2017-10-31 14:59:27 +00:00
zombieJ 2b3592331e Pass `pendingProps` as argument in `createWorkInProgress` (#11296)
* move to pendingProps to args

* update userFiber in ReactChildFiber

* prettier it

* prettier it

* move expirationTime to the last

* move expirationTime to the last on userFiber

* Move assignment
2017-10-31 13:46:17 +00:00
Nic Bonetto 544d5c7208 Fixed invalid prop types error message to be more specific (#11308)
* Modified tests and corrected error message. #3

* Fixed syntax issues. #3

* Modified test. #3

* Prettified. #3

* Changed warning message to handle true and false boolean values. #3

* Changed test to contain undefined instead of value. #3

* Simplified branch structure. #3

* Refactored branching logic. #3

* Refactored falsy warning message and tests. #3

* Changed condition to attribute name. #3

* Refactored falsy and truthy warning messages with tests updated. #3

* Added missing character. #3

* Fixed warning message. #3

* Cleared extra whitespace. #3

* Refactored warning messages to be clear. #3

* Prettified. #3

* Grammar fix

* Tweak unrelated warning

The message didn't make sense because it appears for *any* attributes, not just numeric ones.

* Tweak the message for more clarity

* Add a special message for false event handlers

* Add missing whitespace

* Revert size changes
2017-10-31 13:02:41 +00:00
Anushree Subramani 3f1f3dc12e Deduplicated many warnings (#11140) (#11216)
*  Deduplicated many warnings (#11140)

*  Deduplicated the following warnings:

1.  Can only update a mounted or mounting component.
    This usually means you called setState, replaceState,
    or forceUpdate on an unmounted component. This is a no-op

2.  %s.componentWillReceiveProps(): Assigning directly to
    this.state is deprecated (except inside a component's
    constructor). Use setState instead.'

3.  An update (setState, replaceState, or forceUpdate) was scheduled
    from inside an update function. Update functions should be pure,
    with zero side-effects. Consider using componentDidUpdate or a
    callback.

4.  setState(...): Cannot call setState() inside getChildContext()

* Code review changes made for #11140

* Minor style fix

* Test deduplication for noop updates in server renderer

* Test deduplication for cWRP warning

* Test deduplication for cWM setState warning

* Test deduplication for unnmounted setState warning

* Fix existing Flow typing

* Test deduplication for invalid updates

* Test deduplication of update-in-updater warning
2017-10-31 12:35:28 +00:00
shawn wang 7f10fae4c1 Warn if class has a render() method but doesn't extend React.Component (#11168)
Warn if class has a render() method but doesn't extend React.Component
2017-10-31 12:02:55 +00:00
Neal Wright 4a43cf6eac Changed the error message displayed when a select element has props.multiple set to true and value set to null (#11141)
* Corrects error message for select with props.multiple set to true and a null value.

* Don't bother deduplicating based on type

* Make the code a bit simpler (and more verbose)
2017-10-31 11:47:59 +00:00
Clement Hoang 4ce5da7aee
Add Fragment as a named export to React (#10783)
* Add Fragment as a named export to React

* Remove extra tests for Fragment

* Change React.Fragment export to be a string '#fragment'

* Fix fragment special case to work with 1 child

* Add single child test for fragment export

* Move fragment definition to ReactEntry.js and render components for key warning tests

* Inline createFiberFromElementType into createFiberFromElement

* Update reconciliation to special case fragments

* Use same semantics as implicit childsets for ReactFragment

* Add more fragment state preservation tests

* Export symbol instead of string for fragments

* Fix rebase breakages

* Re-apply prettier at 1.2.2

* Merge branches in updateElement

* Remove unnecessary check

* Re-use createFiberFromFragment for fragment case

* Simplyify branches by adding type field to fragment fiber

* Move branching logic for fragments to broader methods when possible.

* Add more tests for fragments

* Address Dan's feedback

* Move REACT_FRAGMENT_TYPE into __DEV__ block for DCE

* Change hex representation of REACT_FRAGMENT_TYPE to follow convention

* Remove unnecessary branching and isArray checks

* Update test for preserving children state when keys are same

* Fix updateSlot bug and add more tests

* Make fragment tests more robust by using ops pattern

* Update jsx element validator to allow numbers and symbols

* Remove type field from fragment fiber

* Fork reconcileChildFibers instead of recursing

* Use ternary if condition

* Revamp fragment test suite:

- Add more coverage to fragment tests
- Use better names
- Remove useless Fragment component inside tests
- Remove useless tests so that tests are more concise

* Check output of renderer in fragment tests to ensure no silly business despite states being preserved

* Finish implementation of fragment reconciliation with desired behavior

* Add reverse render direction for fragment tests

* Remove unneeded fragment branch in updateElement

* Add more test cases for ReactFragment

* Handle childless fragment in reconciler

* Support fragment flattening in SSR

* Clean up ReactPartialRenderer

* Warn when non-key and children props are passed to fragments

* Add non-null key check back to updateSlot's array's case

* Add test for positional reconciliation in fragments

* Add warning for refs in fragments with stack trace
2017-10-30 17:52:40 -07:00
Márcio Vicente d61af82390 Removing dot to avoid redirect to facebook.com (#11400)
* Removing dot to avoid redirect to facebook.com

* Changing phrase instead of using

* Tweak test

* Reset unrelated file
2017-10-30 14:16:18 +00:00
Dan Abramov 177cd85253
Reorder badges by colors 2017-10-28 18:57:19 +01:00
Aleem 84a2891b14 Added MIT license badge along with other existing badges. (#11391) 2017-10-28 12:36:23 +01:00
Sebastian Markbåge 696908f496
[CS] Implement Some Stuff (#11390)
* Implement CS first take

This is using a pure JS API. This should probably switch to native hooks
at some later point but I'll start ironing out issues at this level first.

* Use async scheduling by default

The scheduled callback gets called immediately in render with infinite
time for now. Later this will be per root and abortable.

* Fix up the type signature of the ReactNativeCSType export

* Add escape hatch for special cased children

Working around the fact that we can't map arbitrary children slots. Just
the "children" prop.

* Readd providesModule for ReactNativeCSTypes

* Fix lint

* Fix ReactNativeTypes providesModule and CI check

* Special case a parent instance that doesn't have a props object

CSCustom can be anything here. Ugly but whatevs.

* Don't forget to store stateUpdater so that we can trigger updates

* Fix test
2017-10-27 20:05:34 -07:00
Dan Abramov cc54b6f48a
Add a shim for React 16.0.0 future compatibility (#11388) 2017-10-27 17:38:59 +01:00
Lucas Lentz 55b3172f1d Rewrite ReactDOMInput-test depending on internal API (#11299) (#11309)
* Rewrite tests depending on internal API

* Remove focus being called when there was no blur event function before

* Remove triggering function and just let ReactTestUtils take care

* Use native events

* Remove duplicate

* Simulate native event when changing value on reentrant

* Change wasn't being called

* Use Simulate only

* Use React event handlers on test

* Move commentary

* Lint commit

* Use native event

* Comment native event dispatching

* Prettier

* add setUntrackedValue

* Prettier-all

* Use dispatchEvent instead of ReactTestUtils Simulates;

* Prettier

* Fix lint

* Remove useless arg

* Wrap event dispatcher into function

* Remove deprecated Event

* Remove unused change event dispatcher

* Fix merge

* Prettier

* Add missing focus/blur calls

They are necessary to cover for the fix in #8240.
2017-10-26 19:22:10 +01:00
Andrew Clark f751bd8877 Fuzz test across multiple roots (#11376)
While refactoring root scheduler, I noticed we have few tests that
cover updates across multiple roots. To address, I've added multiple
root cases to the fuzz tester.

Includes a hard-coded test case that was failing before #11307 landed.
2017-10-26 11:03:40 -07:00
Dan Abramov 5f6159fa84 Coverage works again 2017-10-26 18:57:30 +01:00
Thiago Galvani dee4cc2cb3 Documentation on README (#11368)
* Adding the Documentation to the README

* Updating the Documentation to the README

* Tweaks
2017-10-26 18:06:25 +01:00
Dustan Kasten 80849fd1c6 Flow-ify ReactPartialRenderer (#11251)
* flow ReactPartialRenderer

* prettier

* moving flow type around;

* Move anys to DEV-only code path and keep it typechecked

* Increase Flow coverage
2017-10-26 17:59:29 +01:00
Matteo Vesprini-Heidrich b0bb1b46aa reference yarn instead of npm in dom fixtures README (#11374)
* reference yarn instead of npm in dom fixtures README

* Update README.md
2017-10-26 17:51:58 +01:00
Matteo Vesprini-Heidrich bd3a00b326 make yarn lock file current (#11375) 2017-10-26 17:51:33 +01:00
Dustan Kasten 399029444f maybe proactively redirect some doc site issues (#11235)
* maybe proactively redirect some doc site issuesg

* Update ISSUE_TEMPLATE.md
2017-10-26 15:27:16 +01:00
Dan Abramov 8f4ccc2bd3 Fix stray absolute imports 2017-10-26 15:18:34 +01:00
Dan Abramov 707ca7f492 Update Jest and remove hacks (#11372)
* Update Jest

* Remove hacks for Jest + Workspace integration

They were fixed by https://github.com/facebook/jest/pull/4761.

* Use relative requires in tests relying on private APIs

I changed them to absolute to work around a Jest bug.
The bug has been fixed so I can revert my past changes now.
2017-10-26 15:15:24 +01:00
Andrew Clark 3addf205bf Remove Task priority (#11307)
* Remove Task priority

The concept of Task priority was originally added as a way to avoid
reentrancy. Sync priority is for work that flushes synchronously, and
Task is for work that flushes at the end of the event loop.

But it turns out that in most cases, it's simpler to model Task and
Sync as the same priority level. For example, it's never correct to
flush Sync work from the update queue without flushing Task. Doing so
can lead to infinite update loops.

And using a separate priority level is not necessary to avoid
reentrancy. We already track when work is being rendered, and exit
before entering the render cycle again. That alone is sufficient.

This commit removes Task priority from the codebase. Now we use the
same level for both truly synchronous work and work that is deferred
until the end of the event loop.

This also enables us to remove DOM-specific legacy cases from the 
reconciler and lift them to the renderer.

* Remove isUnbatched from FiberRoot

Simpler to render unbatched roots immediately.

* Use a cyclic linked list for root schedule

Avoids the need for a separate `isScheduled` field.
2017-10-25 16:51:45 -07:00
Brian Vaughn c86ae4b46f Added naive scheduleDeferredCallback implementation for RN (#11362)
* Added naive scheduleDeferredCallback implementation for RN

* Fixed ReactNative shim's expected @provideModule
2017-10-25 14:13:34 -07:00
Dan Abramov 396eb8698b Add disclaimer 2017-10-25 20:47:47 +01:00
Dan Abramov 2c0a8fb99e Add react-call-return package (#11364) 2017-10-25 22:23:55 +03:00
Dan Abramov 8e1f7f76fb Temporarily hide broken coverage reporting 2017-10-25 19:12:13 +01:00