@samitouri / QOS-React / commits / 90b7facd52

Don't use the render callback with promises (#10050)

This covers up errors that are thrown in Fiber, because callback gets fired *and* an error is thrown. Created a follow up #10049 to reevaluate these semantics. # Conflicts: # scripts/fiber/tests-passing-except-dev.txt # scripts/fiber/tests-passing.txt

Sebastian Markbåge committed Jun 27, 2017 at 08:24 UTC 90b7facd52ffd9acc8ba4a5d608b27ef4bfae01d
3 files changed +12 -9
scripts/fiber/tests-passing-except-dev.txt
-6
@@ -86,12 +86,6 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js
86 * renders a div with a single child surrounded by whitespace with client render on top of bad server markup
87 * renders >,<, and & as single child with client render on top of bad server markup
88 * renders >,<, and & as multiple children with client render on top of bad server markup
89 -* throws when rendering a string component with clean client render
90 -* throws when rendering a string component with client render on top of bad server markup
91 -* throws when rendering an undefined component with clean client render
92 -* throws when rendering an undefined component with client render on top of bad server markup
93 -* throws when rendering a number component with clean client render
94 -* throws when rendering a number component with client render on top of bad server markup
89 * renders an input with a value and an onChange with client render on top of bad server markup
90 * renders an input with a value and readOnly with client render on top of bad server markup
91 * renders an input with a value and no onChange/readOnly with client render on top of bad server markup
scripts/fiber/tests-passing.txt
+6
@@ -1206,8 +1206,14 @@ src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js
1206 * renders >,<, and & as multiple children with clean client render
1207 * renders >,<, and & as multiple children with client render on top of good server markup
1208 * throws when rendering a string component with server string render
1209 +* throws when rendering a string component with clean client render
1210 +* throws when rendering a string component with client render on top of bad server markup
1211 * throws when rendering an undefined component with server string render
1212 +* throws when rendering an undefined component with clean client render
1213 +* throws when rendering an undefined component with client render on top of bad server markup
1214 * throws when rendering a number component with server string render
1215 +* throws when rendering a number component with clean client render
1216 +* throws when rendering a number component with client render on top of bad server markup
1217 * throws when rendering null with server string render
1218 * throws when rendering null with clean client render
1219 * throws when rendering null with client render on top of bad server markup
src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js
+6 -3
@@ -28,9 +28,12 @@ const stream = require('stream');
28
29 // promisified version of ReactDOM.render()
30 function asyncReactDOMRender(reactElement, domElement) {
31 - return new Promise(resolve =>
32 - ReactDOM.render(reactElement, domElement, resolve),
33 - );
31 + return new Promise(resolve => {
32 + ReactDOM.render(reactElement, domElement);
33 + // We can't use the callback for resolution because that will not catch
34 + // errors. They're thrown.
35 + resolve();
36 + });
37 }
38 // performs fn asynchronously and expects count errors logged to console.error.
39 // will fail the test if the count of errors logged is not equal to count.