Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit 2f17c23

Browse files
Hedger WangHedger Wang
authored andcommitted
Merge branch 'master' of https://github.com/facebook/react-devtools into banana_slug
Conflicts: shells/chrome/manifest.json
2 parents da3e0f1 + b264086 commit 2f17c23

22 files changed

Lines changed: 16493 additions & 85 deletions

.flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
1515
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue
1616

1717
[version]
18-
0.18.1
18+
0.20.1

agent/Agent.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class Agent extends EventEmitter {
160160
// used to "view source in Sources pane"
161161
bridge.on('putSelectedInstance', id => {
162162
var node = this.elementData.get(id);
163-
if (node.publicInstance) {
163+
if (node && node.publicInstance) {
164164
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.$inst = node.publicInstance;
165165
} else {
166166
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.$inst = null;
@@ -210,7 +210,7 @@ class Agent extends EventEmitter {
210210
highlight(id: ElementID) {
211211
var data = this.elementData.get(id);
212212
var node = this.getNodeForID(id);
213-
if (node) {
213+
if (data && node) {
214214
this.emit('highlight', {node, name: data.name, props: data.props});
215215
}
216216
}
@@ -234,7 +234,7 @@ class Agent extends EventEmitter {
234234
return null;
235235
}
236236
var renderer = this.renderers.get(id);
237-
if (this.reactInternals[renderer].getNativeFromReactElement) {
237+
if (renderer && this.reactInternals[renderer].getNativeFromReactElement) {
238238
return this.reactInternals[renderer].getNativeFromReactElement(component);
239239
}
240240
}
@@ -275,7 +275,7 @@ class Agent extends EventEmitter {
275275

276276
_setProps({id, path, value}: {id: ElementID, path: Array<string>, value: any}) {
277277
var data = this.elementData.get(id);
278-
if (data.updater && data.updater.setInProps) {
278+
if (data && data.updater && data.updater.setInProps) {
279279
data.updater.setInProps(path, value);
280280
} else {
281281
console.warn("trying to set props on a component that doesn't support it");
@@ -284,7 +284,7 @@ class Agent extends EventEmitter {
284284

285285
_setState({id, path, value}: {id: ElementID, path: Array<string>, value: any}) {
286286
var data = this.elementData.get(id);
287-
if (data.updater && data.updater.setInState) {
287+
if (data && data.updater && data.updater.setInState) {
288288
data.updater.setInState(path, value);
289289
} else {
290290
console.warn("trying to set state on a component that doesn't support it");
@@ -293,7 +293,7 @@ class Agent extends EventEmitter {
293293

294294
_setContext({id, path, value}: {id: ElementID, path: Array<string>, value: any}) {
295295
var data = this.elementData.get(id);
296-
if (data.updater && data.updater.setInContext) {
296+
if (data && data.updater && data.updater.setInContext) {
297297
data.updater.setInContext(path, value);
298298
} else {
299299
console.warn("trying to set state on a component that doesn't support it");
@@ -302,6 +302,9 @@ class Agent extends EventEmitter {
302302

303303
_makeGlobal({id, path}: {id: ElementID, path: Array<string>}) {
304304
var data = this.elementData.get(id);
305+
if (!data) {
306+
return;
307+
}
305308
var value;
306309
if (path === 'instance') {
307310
value = data.publicInstance;

agent/Bridge.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,11 @@ class Bridge {
285285
}
286286

287287
if (payload.type === 'callback') {
288-
this._cbs.get(payload.id)(...payload.args);
289-
this._cbs.delete(payload.id);
288+
var callback = this._cbs.get(payload.id);
289+
if (callback) {
290+
callback(...payload.args);
291+
this._cbs.delete(payload.id);
292+
}
290293
return;
291294
}
292295

@@ -346,12 +349,14 @@ class Bridge {
346349
}
347350

348351
_inspectResponse(id: string, path: Array<string>, callback: number) {
349-
var val = getIn(this._inspectables.get(id), path);
352+
var inspectable = this._inspectables.get(id);
353+
350354
var result = {};
351355
var cleaned = [];
352356
var proto = null;
353357
var protoclean = [];
354-
if (val) {
358+
if (inspectable) {
359+
var val = getIn(inspectable, path);
355360
var protod = false;
356361
var isFn = typeof val === 'function';
357362
Object.getOwnPropertyNames(val).forEach(name => {

frontend/DataView/DataView.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,12 @@ class DataItem extends React.Component {
190190
}
191191
}
192192

193-
function alphanumericSort(a, b) {
193+
function alphanumericSort(a: string, b: string): number {
194194
if ('' + (+a) === a) {
195195
if ('' + (+b) !== b) {
196196
return -1;
197197
}
198-
a = +a;
199-
b = +b;
198+
return (+a < +b) ? -1 : 1;
200199
}
201200
return (a < b) ? -1 : 1;
202201
}

frontend/Highlighter/Highlighter.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ class Highlighter {
6262
if (!this._overlay) {
6363
this._overlay = new Overlay(this._win);
6464
}
65-
// $FlowFixMe this._overlay is clearly not null at this point
6665
this._overlay.inspect(node, name);
6766
}
6867

@@ -71,7 +70,6 @@ class Highlighter {
7170
if (!this._multiOverlay) {
7271
this._multiOverlay = new MultiOverlay(this._win);
7372
}
74-
// $FlowFixMe this._multiOverlay is clearly not null at this point
7573
this._multiOverlay.highlightMany(nodes);
7674
}
7775

frontend/Store.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ class Store extends EventEmitter {
219219
.map(([key, val]) => key)
220220
.toList();
221221
}
222-
// $FlowFixMe this.searchRoots is not falsey
223222
this.searchRoots.forEach(id => {
224223
if (this.hasBottom(id)) {
225224
this._nodes = this._nodes.setIn([id, 'collapsed'], true);

frontend/decorate.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ module.exports = function(options: Options, Component: any): any {
120120
}
121121

122122
Wrapper.contextTypes = {
123-
// $FlowFixMe computed property
124123
[storeKey]: React.PropTypes.object,
125124
};
126125

frontend/provideStore.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ module.exports = function(name: string): Object {
1919
store: Object,
2020
};
2121
getChildContext() {
22-
// $FlowFixMe computed property
2322
return {[name]: this.props.store};
2423
}
2524
render() {
2625
return this.props.children();
2726
}
2827
}
2928
Wrapper.childContextTypes = {
30-
// $FlowFixMe computed property
3129
[name]: React.PropTypes.object,
3230
};
3331
Wrapper.displayName = 'StoreProvider(' + name + ')';

0 commit comments

Comments
 (0)