Commit Graph
9779 Commits
Author SHA1 Message Date
Nicole LevyandDan Abramov 76ef077918 Clarify ReactDOM's case warning for html tags (#12533)
* update warning text

* update tests to match

* `yarn prettier`

* include note on HTML5 custom elements

* dan’s copy suggestion

* remove ‘letters’
2018-04-04 22:21:06 +01:00
Brian VaughnandGitHub 535406723f Removed Array.from() usage (#12546) 2018-04-04 13:54:27 -07:00
Brian VaughnandBrandon Dail 43634529a0 Removed duplicate typeof check (#12541) 2018-04-04 13:30:48 -07:00
Dan AbramovandGitHub 80f6b01309 facebook.github.io/react -> reactjs.org (#12545) 2018-04-04 21:20:41 +01:00
Dan AbramovandGitHub 6750bba6af Don't render bitmask-bailing consumers even if there's a deeper matching child (#12543)
* Don't render consumers that bailed out with bitmask even if there's a deeper matching child

* Use a render prop in the test

Without it, <Indirection> doesn't do anything because we bail out on constant element anyway.
That's not what we're testing, and could be confusing.
2018-04-04 19:44:14 +01:00
Dan AbramovandGitHub 1a32fc019a Add a build step to hoist warning conditions (#12537) 2018-04-04 17:04:40 +01:00
Dan Abramov cd4a2b9d7f Changelog for 16.3.1 2018-04-04 01:35:36 +01:00
Dan Abramov 0ad850cbe6 Update bundle sizes for 16.3.1 release 2018-04-04 01:33:06 +01:00
Dan Abramov bba27245bb Updating package versions for release 16.3.1 2018-04-04 01:22:30 +01:00
Dan Abramov 1515fdc32a Updating yarn.lock file for 16.3.1 release 2018-04-04 01:20:48 +01:00
Dan AbramovandGitHub 8d2cf0771c Follow up: make new warning less wordy (#12532) 2018-04-03 21:56:21 +01:00
Dan AbramovandGitHub 124c35b70a Improve not-yet-mounted setState warning (#12531)
* Tweak not-yet-mounted setState warning

* Add \n\n
2018-04-03 21:22:44 +01:00
Andrew ClarkandGitHub de515d0ace getDerivedStateFrom{Props,Catch} should update updateQueue.baseState (#12528)
Based on a bug found in UFI2.

There have been several bugs related to the update queue (and
specifically baseState) recently, so I'm going to follow-up with some
refactoring to clean it up. This is a quick fix so we can ship a
patch release.
2018-04-03 13:02:46 -07:00
Dan AbramovandGitHub a75d5aecf8 Remove @providesModule in www bundles (#12529) 2018-04-03 20:12:29 +01:00
Brian VaughnandGitHub 093e8ca36b Bumped create-subscription package version (#12526) 2018-04-03 11:06:52 -07:00
Mateusz BurzyńskiandDan Abramov dc1f4473bd Prefix _context property on returned ReactContext from createContext - it's private (#12501) 2018-04-03 01:47:25 +01:00
Andrew ClarkandDan Abramov c6caeed754 Extract throw to separate function so performUnitOfWork does not deopt (#12521)
Only affects DEV mode, but still important I think.
2018-04-03 01:45:52 +01:00
Dan AbramovandGitHub 61448092d2 Fix context stack misalignment caused by error replay (#12508)
* Add regression tests for error boundary replay bugs

* Ensure the context stack is aligned if renderer throws

* Always throw when replaying a failed unit of work

Replaying a failed unit of work should always throw, because the render
phase is meant to be idempotent, If it doesn't throw, rethrow the
original error, so React's internal stack is not misaligned.

* Reset originalReplayError after replaying

* Typo fix
2018-04-03 00:08:30 +01:00
Flarnie MarchanandGitHub 8d2580cf21 Update user timing to record when we are about to commit (#12384)
* Update user timing to record when we are about to commit

**what is the change?:**
After repeatedly logging '(React Tree Reconciliation)' we vary the
message slightly for the last reconciliation, which happens right before
we commit.

**why make this change?:**
When debugging performance in the devtools it will be helpful if we can
quickly see where the 'commit' happens in a potentially long list of
sliced '(React Tree Reconciliation)' logs.

**test plan:**
Built and ran one of the fixtures. Also ran the unit test.

(Flarnie will insert a screenshot)

* Ran prettier

* Fixes in response to code review

* Update snapshot tests

* Move isWorking assignment out of branches to top

* Stricter type for stopWorkLoopTimer args
2018-04-02 15:27:33 -07:00
Dan AbramovandGitHub 6a3b39b3fe Add missing changelog item 2018-04-02 16:07:16 +01:00
Dan AbramovandGitHub e4219063b7 Fix DEV performance regression by avoiding Object.assign on Fibers (#12510)
* Fix DEV performance regression by avoiding Object.assign on Fibers

* Reduce allocations in hot path by reusing the stash

Since performUnitOfWork() is not reentrant, it should be safe to reuse the same stash every time instead of creating a new object.
2018-04-01 19:10:37 +01:00
heikkilamarkoandDan Abramov d70ada15b8 Validate React.Fragment props without Map. (#12504) 2018-04-01 01:14:36 +01:00
Minh NguyenandBrian Vaughn 24629a28b5 Change create-subscription's peerDep on react to ^16.3.0 (#12496) 2018-03-30 14:49:34 -07:00
Dan AbramovandGitHub fbab4981b6 Fix method name in changelog 2018-03-29 23:27:06 +01:00
Dan AbramovandGitHub 08bb022359 Move context API in Changelog to "React" section 2018-03-29 23:19:53 +01:00
Dan AbramovandGitHub 4064dc511f Fix links 2018-03-29 22:08:20 +01:00
Dan AbramovandGitHub 6d2a95f6b5 Add React 16.3.0 changelog (#12488) 2018-03-29 21:56:45 +01:00
Brian Vaughn 91a8e3fec9 Update bundle sizes for 16.3.0 release 2018-03-29 13:07:12 -07:00
Brian Vaughn acff7370da Updating dependencies for react-noop-renderer 2018-03-29 13:03:33 -07:00
Brian Vaughn 1c895fbc76 Updating package versions for release 16.3.0 2018-03-29 13:03:33 -07:00
Brian VaughnandGitHub 6bfd14f632 unstable_createRoot (#12487)
* Removed enableCreateRoot flag. Renamed createRoot to unstable_createRoot

* ReactDOMRoot test is no longer internal
2018-03-29 12:51:34 -07:00
Dan AbramovandGitHub 607bcd9241 Disable createRoot for open source builds (#12486) 2018-03-29 20:25:20 +01:00
Brian Vaughn b75e3de86c Updated react-is README to show new isValidElementType() 2018-03-29 11:46:18 -07:00
James ReggioandBrian Vaughn baa1e1cd09 Add React.isValidElementType() (#12483)
* Add React.isValidElementType()

Per the conversation on #12453, there are a number of third-party
libraries (particularly those that generate higher-order components)
that are performing suboptimal validation of element types.

This commit exposes a function that can perform the desired check
without depending upon React internals.

* Move isValidElementType to shared/
2018-03-29 11:45:41 -07:00
Flarnie MarchanandGitHub 990c71cf4d Update user timing to record the timeout deadline with 'waiting' events (#12479)
* Update user timing to record the timeout deadline with 'waiting' events

**what is the change?:**
When we are processing work during reconciliation, we have a "timeout"
deadline to finish the work. It's a safety measure that forces things to
finish up synchronously if they are taking too long.

The "timeout" is different depending on the type of interaction which
triggered the reconciliation. We currently have a shorter "timeout" for
"interactive updates", meaning we will try to finish work faster if the
reconciliation was triggered by a click or other user interaction.

For collecting more data in our logs we want to differentiate the
'waiting for async callback...' events based on the "timeout" so I'm
adding that to the logging.

One interesting note - in one of the snapshot tests the "timeout" was
super high. Going to look into that.

**why make this change?:**
Right now we are debugging cases where an interaction triggers a
reconciliation and the "waiting for async callback...' events are too
long, getting blocked because the main thread is too busy. We are
keeping logs of these user timing events and want to filter to focus on
the reconciliation triggered by interaction.

**test plan:**
Manually tested and also updated snapshot tests.

(Flarnie will insert a screenshot)

* Improve wording of message

* ran prettier
2018-03-29 11:26:11 -07:00
Dustan KastenandDan Abramov dd07d2fe51 Don't bail out on referential equality of Consumer's props.children function (#12470)
* Test case for React Context bailing out unexpectedly

* This is 💯% definitely not the correct fix at all

* Revert "This is 💯% definitely not the correct fix at all"

This reverts commit 8686c0f6bdc1cba3056fb2212f3f7740c749d33a.

* Formatting + minor tweaks to the test

* Don't bail out on consumer child equality

* Tweak the comment

* Pretty lint

* Silly Dan
2018-03-29 19:16:02 +01:00
Sophie AlpertandDan Abramov 99e803e8d3 Improve warning message for setState-on-unmounted (#12347)
This is one of the most common warnings people see, and I don't think the old text is especially clear. Improve it.
2018-03-29 16:21:22 +01:00
Dan AbramovandGitHub 4f133ea882 setState() in componentDidMount() should flush synchronously even with createBatch() (#12466)
* Add a failing test for setState in cDM during batch.commit()

* Copy pasta

* Flush all follow-up Sync work on the committed batch

* Nit: Use performSyncWork

Call performSyncWork right after flushing the batch. Does effectively
the same thing by reusing the existing function.

Also added some comments.

* Delete accidentally duplicated test
2018-03-29 02:41:42 +01:00
Andrew ClarkandGitHub 03b77d2cfc Fix bug when fatal error is thrown as a result of batch.commit (#12480)
Fixes #12474
2018-03-28 18:18:09 -07:00
Andrew ClarkandGitHub 44de2c3251 Add unstable APIs for async rendering to test renderer (#12478)
These are based on the ReactNoop renderer, which we use to test React
itself. This gives library authors (Relay, Apollo, Redux, et al.) a way
to test their components for async compatibility.

- Pass `unstable_isAsync` to `TestRenderer.create` to create an async
renderer instance. This causes updates to be lazily flushed.
- `renderer.unstable_yield` tells React to yield execution after the
currently rendering component.
- `renderer.unstable_flushAll` flushes all pending async work, and
returns an array of yielded values.
- `renderer.unstable_flushThrough` receives an array of expected values,
begins rendering, and stops once those values have been yielded. It
returns the array of values that are actually yielded. The user should
assert that they are equal.

Although we've used this pattern successfully in our own tests, I'm not
sure if these are the final APIs we'll make public.
2018-03-28 14:57:25 -07:00
Brian VaughnandGitHub cf0d83169f Added DEV warning if getSnapshotBeforeUpdate is defined as a static method (#12475) 2018-03-28 13:35:32 -07:00
NikolayandNathan Hunzaker 4162406f47 Fix typo in create-subscription readme
PR: #12473
2018-03-28 08:51:16 -04:00
Brian VaughnandGitHub 33738b790c Fix build script to handle react-is (no peer deps) (#12471) 2018-03-27 19:19:34 -07:00
Brian Vaughn 0a41c3fafa Update bundle sizes for 16.3.0-rc.0 release 2018-03-27 19:11:20 -07:00
Brian Vaughn cdeccca6ae Updating dependencies for react-noop-renderer 2018-03-27 19:07:53 -07:00
Brian Vaughn 8fc13f1972 Updating package versions for release 16.3.0-rc.0 2018-03-27 19:07:53 -07:00
Andrew ClarkandGitHub 3cafb056b1 Caveat about async in create-subscription README (#12469)
* Caveat about async in create-subscription README

* Address Sophie's comments

* Dan's nits
2018-03-27 16:50:12 -07:00
Brian VaughnandGitHub ca51548fb0 Call getSnapshotBeforeUpdate before mutation (#12468)
* Call getSnapshotBeforeUpdate in separate traversal, before mutation (aka revert db84b9a) and add unit test.

* Added a new timer to ReactDebugFiberPerf for Snapshot effects
2018-03-27 15:37:13 -07:00
Brian VaughnandGitHub f96c7d6326 Rename react-is import alias in FB bundles (#12459) 2018-03-27 08:57:11 -07:00
Brian VaughnandGitHub 9da74bb21e Include react-is in FB build targets (#12458) 2018-03-26 16:56:06 -07:00