GeezerVison is showing github.com — Log all errors to console.error by default (#21130) · react/react@0853aab
File treeExpand file treeCollapse file tree Open diff view settings react-client/src/__tests__
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/react-client/src/__tests__/ReactFlight-test.js +14-5Lines changed: 14 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -156,10 +156,15 @@ describe('ReactFlight', () => { | 156 | 156 | return <div ref={ref} />; | 157 | 157 | } | 158 | 158 |
| 159 | | - const event = ReactNoopFlightServer.render(<EventHandlerProp />); | 160 | | - const fn = ReactNoopFlightServer.render(<FunctionProp />); | 161 | | - const symbol = ReactNoopFlightServer.render(<SymbolProp />); | 162 | | - const refs = ReactNoopFlightServer.render(<RefProp />); | | 159 | + const options = { | | 160 | + onError() { | | 161 | + // ignore | | 162 | + }, | | 163 | + }; | | 164 | + const event = ReactNoopFlightServer.render(<EventHandlerProp />, options); | | 165 | + const fn = ReactNoopFlightServer.render(<FunctionProp />, options); | | 166 | + const symbol = ReactNoopFlightServer.render(<SymbolProp />, options); | | 167 | + const refs = ReactNoopFlightServer.render(<RefProp />, options); | 163 | 168 |
| 164 | 169 | function Client({transport}) { | 165 | 170 | return ReactNoopFlightClient.read(transport); | @@ -213,7 +218,11 @@ describe('ReactFlight', () => { | 213 | 218 | ); | 214 | 219 | } | 215 | 220 |
| 216 | | - const data = ReactNoopFlightServer.render(<Server />); | | 221 | + const data = ReactNoopFlightServer.render(<Server />, { | | 222 | + onError(x) { | | 223 | + // ignore | | 224 | + }, | | 225 | + }); | 217 | 226 |
| 218 | 227 | function Client({transport}) { | 219 | 228 | return ReactNoopFlightClient.read(transport); | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-server/src/ReactFizzServer.js +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -142,13 +142,17 @@ type Request = { | 142 | 142 | // 500 * 1024 / 8 * .8 * 0.5 / 2 | 143 | 143 | const DEFAULT_PROGRESSIVE_CHUNK_SIZE = 12800; | 144 | 144 |
| | 145 | +function defaultErrorHandler(error: mixed) { | | 146 | + console['error'](error); // Don't transform to our wrapper | | 147 | +} | | 148 | + | 145 | 149 | export function createRequest( | 146 | 150 | children: ReactNodeList, | 147 | 151 | destination: Destination, | 148 | 152 | responseState: ResponseState, | 149 | 153 | rootContext: FormatContext, | 150 | 154 | progressiveChunkSize: number = DEFAULT_PROGRESSIVE_CHUNK_SIZE, | 151 | | - onError: (error: mixed) => void = noop, | | 155 | + onError: (error: mixed) => void = defaultErrorHandler, | 152 | 156 | onCompleteAll: () => void = noop, | 153 | 157 | onReadyToStream: () => void = noop, | 154 | 158 | ): Request { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-server/src/ReactFlightServer.js +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -91,7 +91,9 @@ export type Request = { | 91 | 91 |
| 92 | 92 | const ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; | 93 | 93 |
| 94 | | -function defaultErrorHandler() {} | | 94 | +function defaultErrorHandler(error: mixed) { | | 95 | + console['error'](error); // Don't transform to our wrapper | | 96 | +} | 95 | 97 |
| 96 | 98 | export function createRequest( | 97 | 99 | model: ReactModel, | |
|