Commit Graph

8862 Commits

Author SHA1 Message Date
Dan Abramov 4e6cc2f495 Warn on missing Set/Map polyfills (#10356)
* Crash on missing Set/Map polyfills

* Change Map/Set to emit warnings instead

* Change rAF polyfill check to also be a warning

* Liiiiiint
2017-08-02 18:55:18 +01:00
Toru Kobayashi ffec3be560 Remove an unnecessary __DEV__ condition (#10350) 2017-08-02 17:57:41 +01:00
Brian Vaughn 2da37a8a44 Shallow renderer passes context to componentWillReceiveProps (#10342)
This parameter was accidentally omitted before. Leland reported it because it impacts Enzyme.
I also added a basic lifecycle parameter test for shallow renderer.
2017-08-02 08:18:46 -07:00
Andrew Clark 372445735e Remove rAF export from ReactDOMFrameScheduling (#10337)
Fiber doesn't schedule animation callbacks anymore (though it does use
the browser's requestAnimationFrame to polyfill requestIdleCallback).

This removes the rAF export from ReactDOMFrameScheduling, since it's not
being used.
2017-08-02 19:56:37 +05:30
Nathan Hunzaker 81706eeb7a Remove event namespace check from react-partial-renderer (#10344) 2017-08-02 11:30:44 +01:00
Toru Kobayashi 7917709782 Fix a typo (#10349) 2017-08-02 11:09:09 +01:00
Michał Pierzchała 73217a74a0 Fix error-codes not updating correctly (#10348)
* Fix error-codes not updating correctly

* Revert changes to codes.json
2017-08-02 10:38:27 +01:00
Greg Hurrell c5d1558a5b Grammar fixes for a code comment (#10343) 2017-08-02 01:20:53 +01:00
Dan Abramov 35e3133610 Remove hydrate() warning about empty container (#10345)
* Remove hydrate() warning about empty container

It used to have false positives for cases where we legitimately don't render anything.

* Use existing constant

* Test empty string case using its parent
2017-08-02 01:05:56 +01:00
Dan Abramov a43ba2625b Add an extra test for arrays and strings from composites (#10346) 2017-08-02 01:05:42 +01:00
Dan Abramov f8062df1d6 Add ReactDOM.hydrate() as explicit SSR hydration API (#10339)
* Add ReactDOM.hydrate()

* Deprecate ReactDOM.render() hydration in favor of ReactDOM.hydrate()

* Downgrade the warning level to console.warn()

* Warn when hydrate() is called with empty container
2017-08-01 21:17:24 +01:00
Dan Abramov a2ed7a6d96 Make unexpected console.warn() calls fail tests (#10341)
* Make console.warn() calls fail tests

* Replace matchers with a more straightforward cleanup
2017-08-01 19:53:37 +01:00
Brian Vaughn d947654913 Context improvements (#10334)
Refactored fiber context to fix a nested updates bug
2017-08-01 08:38:54 -07:00
Dan Abramov 78165276c7 Test for specific SSR warning (#10340)
* Test for specific SSR warning

* Same in another place
2017-08-01 14:38:17 +01:00
Jack Ford 04db3511fe Remove trapBubbledEventsLocal (#10258)
* Inline trapBubbledEventsLocal

* Revert "Inline trapBubbledEventsLocal"

This reverts commit 0ee65ff491.

* Merge remove-local-trap-bubbled-events branch
2017-08-01 08:37:26 +01:00
Toru Kobayashi 73038840ef Move ShallowRenderer tests (#10184) 2017-08-01 08:27:28 +01:00
Toru Kobayashi 56cd54f0ad Add tests that ShallowRenderer supports string and fragment (#10241) 2017-08-01 00:39:43 +01:00
Dan Abramov 1454f9c10c Fix invariant parity for SSR (#10333) 2017-07-31 21:13:50 +01:00
Dan Abramov 67347a6459 Fix SSR integration test swallowing lack of expected error (#10331)
* Don't catch the assertion about missing errors

Previously, even if an error was not thrown, the assertion about this was ignored.

This fix exposes two failing cases in new SSR that weren't failing in Stack.

* Add child context validation to new SSR

This fixes the error cases that were silently failing before but are now exposed.
2017-07-31 17:57:05 +01:00
guoyong yi f732fc677b fix renderToString fails with array type children when react-dom/server render (#10221)
* fix(*): fix renderToString fails with array type children when react-dom/server render

* Add an integration test that verify renderToString with array type children

* Add integration test to renderToString with array type child

* Update integration test to renderToString with array type child

* fix renderToString fails with array type children when react-dom/server render

* Update integration test to renderToString with array type child

* Add to iterate that are not arrays

* Add the validation react element

* Improve an integration test of server renderToString with array type

* prettier

* prettier

* Make SSR can handle a single array element and nested array

* prettier

* Change integeration test description

* 	modified:   src/renderers/dom/ReactDOMNodeStreamRenderer.js

* Make invariants consistent

* Gate outdated test itself by feature flag

* Change test to make sense both with old and new code

* Test more cases
2017-07-31 16:59:14 +01:00
Dominic Gannaway ca46c5278f Move line to within DEV block (#10316)
* move line to within DEV block

* addressed code review feedback
2017-07-27 17:31:34 -07:00
Dan Abramov c7e9044c51 Make it more specific 2017-07-27 23:44:43 +01:00
Fernando Montoya 95cec9927c Add Babel plugin note to Error boundaries post (#10313)
* Add Babel plugin note to Error boundaries post

* Added section with screenshots

* Add context to Component stack traces

* Update 2017-07-26-error-handling-in-react-16.md

* Move section, more minor changes

* Change pics
2017-07-27 23:25:59 +01:00
Dominic Gannaway 6b3b9b5563 Wraps two warnings that should be removed from PROD (#10315) 2017-07-27 11:24:34 -07:00
Nathan Hunzaker 083cc5f4f9 Add date time test fixtures (#10154)
* Add date time test fixtures

This commit adds a new section for the DOM test fixtures specifically
for date inputs. Additionally, it adds a test case to verify that
correct transference of dates between the `"date"` and
`"datetime-locale"` input types.

* Adjust date parsing to be clearer
2017-07-27 13:24:04 -04:00
Dan Abramov 138224f6b3 16.0.0-beta.2 2017-07-27 18:06:26 +01:00
Dan Abramov 7a60a80921 Make server hydration warnings more obviously about server (#10312) 2017-07-27 18:02:16 +01:00
Sebastian Markbåge e1cfd6c082 Remove Error event listener eagerly instead of using depth count (#10296)
A little simpler.
2017-07-27 09:45:07 -07:00
Dan Abramov 44c74c7b12 Add smoke tests for styles (including SSR) (#10308)
* Add style to ReactDOM smoke test

* Add production smoke test for ReactDOMServer
2017-07-27 14:58:03 +01:00
Toru Kobayashi 69d07612c5 Add a link for the error boundaries codemod into the blog post (#10305)
* Add a link for the error boundaries codemod into the blog post

* Update 2017-07-26-error-handling-in-react-16.md
2017-07-27 14:57:33 +01:00
Dan Abramov bc0d241be1 Reword further 2017-07-27 10:48:37 +01:00
Daniel Lo Nigro 759690f7b2 Replace "children (and grandchildren)" with "descendants" (#10297) 2017-07-27 10:23:36 +01:00
Keyan Zhang 3abbcc48a5 Fix ReactPartialRenderer in production (#10300) 2017-07-27 10:19:05 +01:00
Dominic Gannaway f92343159d Wrap "warning" call in DEV block to prevent PROD error (#10295)
* re-adds warning module to FB PROD bundle

* Wrap the warning call too
2017-07-26 14:59:44 -07:00
Dan Abramov 1f3de403bc Link to React 16 beta 2017-07-26 21:20:12 +01:00
Dan Abramov 4ac21f2a5f Blog post: Error Handling in React 16 (#10267)
* Blog post: Error Handling in React 16

* Change the date
2017-07-26 21:15:19 +01:00
Brian Vaughn 834d2c6954 Updated package versions and Rollup results 16.0.0-beta.1 2017-07-26 12:55:31 -07:00
Dan Abramov f3b4aaf388 Fix process override in ErrorUtils test (#10293) 2017-07-26 20:40:09 +01:00
Brian Vaughn 36a7d5b326 Fix error utils test failure caused by updating error codes (#10291) 2017-07-26 12:39:58 -07:00
Brian Vaughn 52849c94a7 Updated error codes (after merging in missing code from 15 stable) (#10290) 2017-07-26 12:18:02 -07:00
Dan Abramov 9a290fb1a7 Link warning to error boundary post (#10289) 2017-07-26 19:59:07 +01:00
Brian Vaughn 8d5f2c4324 Regenerate error codes and update bundle size stats (#10287) 2017-07-26 11:21:43 -07:00
Brian Vaughn e2d1bc8a71 Update pre-release instructions for generating error-codes (#10286) 2017-07-26 11:18:32 -07:00
Dan Abramov ac76c95fbc Add a disclaimer to internal invariants (#10285) 2017-07-26 19:08:22 +01:00
Andrew Clark 6c66d38d25 Remove feature test from invokeGuardedCallbackDev (#10283)
The critical semantics are resilient to browser flakiness, so we don't
need this feature test.

Also added comments explaining how invokeGuardedCallback dev works.
2017-07-26 10:01:31 -07:00
Dan Abramov 77e1129628 Delete react-dom-factories package (#10279) 2017-07-26 13:00:58 +01:00
Dan Abramov 66065115dc Update sizes 2017-07-26 12:27:29 +01:00
Dan Abramov dea43046ef Dedupe unknown tag name warning and ignore <time> (#10275)
* Deduplicate unknown DOM tag warning

* Don't warn about <time> because it is widely used

Other browsers implement it, and Chrome will ship it soon too.

* Use hasOwnProperty

* Fix corner case: hasOwnProperty as a tag

* Update comments to be more correct factually
2017-07-26 11:57:29 +01:00
Dan Abramov 5495a7f24a Fix event name check to be more exact (#10274) 2017-07-26 11:56:38 +01:00
Andrew Clark 812cf1c6a3 [invokeGuardedCallback] Handle nested errors across separate renderers (#10270)
invokeGuardedCallback is a function we use in place of try-catch
statement. It accepts a function, and if the function throws, it
captures the error. In production, the implementation is a normal try-
catch. In development, we swap out the prod implementation for a special
version designed to preserve "Pause on all exceptions" behavior of the
browser DevTools.

invokeGuardedCallbackDev works by dispatching an event to a dummy DOM
node and calling the provided function inside a handler for that event.
We also attach an error event handler to the window object. If the
function throws, the global event handler is called and we can access
the error.

The global event handler is added and removed right before and after the
fake event is dispatched. But if invokeGuardedCallbackDev is nested --
 that is, if it's invoked inside the body of another
invokeGuardedCallbackDev -- multiple error event handlers will attached
simultaneously. We only want the handler that corresponds to the deepest
level to handle the error. So we keep track of a depth counter, and
within the event handler, we only handle the error if the current depth
matches the depth at the time the function was invoked.

The problem that we discovered, and that this PR fixes, is that the
depth counter is local to each renderer. So if you nest separate copies
of invokeGuardedCallback from separate renderers, each renderer will
have its own depth counter, and multiple error handlers will fire for a
single, nested error.
2017-07-25 09:44:43 -07:00