@samitouri / QOS-React / commits / 69fc4d32b5

Minor style tweaks

Dan Abramov committed Nov 14, 2016 at 12:56 UTC 69fc4d32b5e0186478366a652c232fe444df73c6
1 file changed +10 -14
src/renderers/shared/fiber/ReactFiberCommitWork.js
+10 -14
@@ -300,17 +300,17 @@ module.exports = function<T, P, I, TI, C>(
300 switch (finishedWork.tag) {
301 case ClassComponent: {
302 const instance = finishedWork.stateNode;
303 - let error = null;
303 + let firstError = null;
304 if (finishedWork.effectTag & Update) {
305 if (!current) {
306 if (typeof instance.componentDidMount === 'function') {
307 - error = tryCallComponentDidMount(instance);
307 + firstError = tryCallComponentDidMount(instance);
308 }
309 } else {
310 if (typeof instance.componentDidUpdate === 'function') {
311 const prevProps = current.memoizedProps;
312 const prevState = current.memoizedState;
313 - error = tryCallComponentDidUpdate(instance, prevProps, prevState);
313 + firstError = tryCallComponentDidUpdate(instance, prevProps, prevState);
314 }
315 }
316 attachRef(current, finishedWork, instance);
@@ -322,29 +322,25 @@ module.exports = function<T, P, I, TI, C>(
322 if (finishedWork.effectTag & Callback) {
323 if (finishedWork.callbackList) {
324 const callbackError = callCallbacks(finishedWork.callbackList, instance);
325 - // since we only want to keep the first error
326 - if (!error) {
327 - error = callbackError;
328 - }
325 + firstError = firstError || callbackError;
326 finishedWork.callbackList = null;
327 }
328 }
332 - if (error) {
333 - trapError(finishedWork, error, false);
329 + if (firstError) {
330 + trapError(finishedWork, firstError, false);
331 }
332 return;
333 }
334 case HostContainer: {
335 const rootFiber = finishedWork.stateNode;
339 - let error = null;
336 + let firstError = null;
337 if (rootFiber.callbackList) {
338 const { callbackList } = rootFiber;
339 rootFiber.callbackList = null;
343 - error = callCallbacks(callbackList, rootFiber.current.child.stateNode);
340 + firstError = callCallbacks(callbackList, rootFiber.current.child.stateNode);
341 }
345 -
346 - if (error) {
347 - trapError(rootFiber, error, false);
342 + if (firstError) {
343 + trapError(rootFiber, firstError, false);
344 }
345 return;
346 }