Remove console.logs from Fiber
The code is sufficiently complex now that this is more noise than helpful. Will just temporary explicit logs in the future.
Sebastian Markbage committed
Jul 6, 2016 at 13:53 UTC
e0e4954061a88f65c3b9ad6041a9b0a1d3881454
8 files changed
+2
-27
src/renderers/noop/ReactNoop.js
-5
@@ -58,12 +58,10 @@ function flattenChildren(children : HostChildren<Instance>) {
58
var NoopRenderer = ReactFiberReconciler({
59
60
updateContainer(containerInfo : Container, children : HostChildren<Instance>) : void {
61
- console.log('Update container #' + containerInfo.rootID);
61
containerInfo.children = flattenChildren(children);
62
},
63
64
createInstance(type : string, props : Props, children : HostChildren<Instance>) : Instance {
66
- console.log('Create instance #' + instanceCounter);
65
const inst = {
66
tag: TERMINAL_TAG,
67
id: instanceCounter++,
@@ -77,17 +75,14 @@ var NoopRenderer = ReactFiberReconciler({
75
},
76
77
prepareUpdate(instance : Instance, oldProps : Props, newProps : Props, children : HostChildren<Instance>) : boolean {
80
- console.log('Prepare for update on #' + instance.id);
78
return true;
79
},
80
81
commitUpdate(instance : Instance, oldProps : Props, newProps : Props, children : HostChildren<Instance>) : void {
85
- console.log('Commit update on #' + instance.id);
82
instance.children = flattenChildren(children);
83
},
84
85
deleteInstance(instance : Instance) : void {
90
- console.log('Delete #' + instance.id);
86
},
87
88
scheduleHighPriCallback(callback) {
src/renderers/shared/fiber/ReactChildFiber.js
+2
-2
@@ -94,7 +94,7 @@ function createSubsequentChild(
94
}
95
return prev;
96
} else {
97
- console.log('Unknown child', newChildren);
97
+ // TODO: Throw for unknown children.
98
return previousSibling;
99
}
100
}
@@ -162,7 +162,7 @@ function createFirstChild(returnFiber, existingChild, newChildren, priority) {
162
}
163
return first;
164
} else {
165
- console.log('Unknown child', newChildren);
165
+ // TODO: Throw for unknown children.
166
return null;
167
}
168
}
src/renderers/shared/fiber/ReactFiberBeginWork.js
-12
@@ -49,7 +49,6 @@ module.exports = function<T, P, I, C>(config : HostConfig<T, P, I, C>) {
49
function updateFunctionalComponent(current, workInProgress) {
50
var fn = workInProgress.type;
51
var props = workInProgress.pendingProps;
52
- console.log('update fn:', fn.name);
52
var nextChildren = fn(props);
53
reconcileChildren(current, workInProgress, nextChildren);
54
workInProgress.pendingWorkPriority = NoWork;
@@ -59,10 +58,7 @@ module.exports = function<T, P, I, C>(config : HostConfig<T, P, I, C>) {
58
var props = workInProgress.pendingProps;
59
if (!workInProgress.stateNode) {
60
var ctor = workInProgress.type;
62
- console.log('mount class:', workInProgress.type.name);
61
workInProgress.stateNode = new ctor(props);
64
- } else {
65
- console.log('update class:', workInProgress.type.name);
62
}
63
var instance = workInProgress.stateNode;
64
instance.props = props;
@@ -72,11 +68,6 @@ module.exports = function<T, P, I, C>(config : HostConfig<T, P, I, C>) {
68
}
69
70
function updateHostComponent(current, workInProgress) {
75
- console.log(
76
- 'host component', workInProgress.type,
77
- typeof workInProgress.pendingProps.children === 'string' ? workInProgress.pendingProps.children : ''
78
- );
79
-
71
var nextChildren = workInProgress.pendingProps.children;
72
73
let priority = workInProgress.pendingWorkPriority;
@@ -109,7 +100,6 @@ module.exports = function<T, P, I, C>(config : HostConfig<T, P, I, C>) {
100
var props = workInProgress.pendingProps;
101
var value = fn(props);
102
if (typeof value === 'object' && value && typeof value.render === 'function') {
112
- console.log('performed work on class:', fn.name);
103
// Proceed under the assumption that this is a class instance
104
workInProgress.tag = ClassComponent;
105
if (workInProgress.alternate) {
@@ -117,7 +107,6 @@ module.exports = function<T, P, I, C>(config : HostConfig<T, P, I, C>) {
107
}
108
value = value.render();
109
} else {
120
- console.log('performed work on fn:', fn.name);
110
// Proceed under the assumption that this is a functional component
111
workInProgress.tag = FunctionalComponent;
112
if (workInProgress.alternate) {
@@ -133,7 +122,6 @@ module.exports = function<T, P, I, C>(config : HostConfig<T, P, I, C>) {
122
if (!coroutine) {
123
throw new Error('Should be resolved by now');
124
}
136
- console.log('begin coroutine', workInProgress.type.name);
125
reconcileChildren(current, workInProgress, coroutine.children);
126
workInProgress.pendingWorkPriority = NoWork;
127
}
src/renderers/shared/fiber/ReactFiberCompleteWork.js
-4
@@ -125,11 +125,9 @@ module.exports = function<T, P, I, C>(config : HostConfig<T, P, I, C>) {
125
function completeWork(current : ?Fiber, workInProgress : Fiber) : ?Fiber {
126
switch (workInProgress.tag) {
127
case FunctionalComponent:
128
- console.log('/functional component', workInProgress.type.name);
128
transferOutput(workInProgress.child, workInProgress);
129
return null;
130
case ClassComponent:
132
- console.log('/class component', workInProgress.type.name);
131
transferOutput(workInProgress.child, workInProgress);
132
return null;
133
case HostContainer:
@@ -142,7 +140,6 @@ module.exports = function<T, P, I, C>(config : HostConfig<T, P, I, C>) {
140
markForPreEffect(workInProgress);
141
return null;
142
case HostComponent:
145
- console.log('/host component', workInProgress.type);
143
const child = workInProgress.child;
144
const children = (child && !child.sibling) ? (child.output : ?Fiber | I) : child;
145
const newProps = workInProgress.pendingProps;
@@ -165,7 +162,6 @@ module.exports = function<T, P, I, C>(config : HostConfig<T, P, I, C>) {
162
}
163
return null;
164
case CoroutineComponent:
168
- console.log('/coroutine component', workInProgress.pendingProps.handler.name);
165
return moveCoroutineToHandlerPhase(current, workInProgress);
166
case CoroutineHandlerPhase:
167
transferOutput(workInProgress.stateNode, workInProgress);
src/renderers/shared/fiber/ReactFiberScheduler.js
-1
@@ -156,7 +156,6 @@ module.exports = function<T, P, I, C>(config : HostConfig<T, P, I, C>) {
156
// "next" scheduled work since we've already scanned passed. That
157
// also ensures that work scheduled during reconciliation gets deferred.
158
// const hasMoreWork = workInProgress.pendingWorkPriority !== NoWork;
159
- console.log('----- COMPLETED with remaining work:', workInProgress.pendingWorkPriority);
159
commitAllWork(workInProgress);
160
const nextWork = findNextUnitOfWork();
161
// if (!nextWork && hasMoreWork) {
src/renderers/shared/fiber/__tests__/ReactCoroutine-test.js
-1
@@ -20,7 +20,6 @@ describe('ReactCoroutine', function() {
20
React = require('React');
21
ReactNoop = require('ReactNoop');
22
ReactCoroutine = require('ReactCoroutine');
23
- spyOn(console, 'log');
23
});
24
25
it('should render a coroutine', function() {
src/renderers/shared/fiber/__tests__/ReactIncremental-test.js
-1
@@ -18,7 +18,6 @@ describe('ReactIncremental', function() {
18
beforeEach(function() {
19
React = require('React');
20
ReactNoop = require('ReactNoop');
21
- spyOn(console, 'log');
21
});
22
23
it('should render a simple component', function() {
src/renderers/shared/fiber/__tests__/ReactIncrementalSideEffects-test.js
-1
@@ -18,7 +18,6 @@ describe('ReactIncremental', function() {
18
beforeEach(function() {
19
React = require('React');
20
ReactNoop = require('ReactNoop');
21
- spyOn(console, 'log');
21
});
22
23
function div(...children) {