Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Commit d94822e

Browse files
committed
Remove objectLink from Reps
1 parent ccbc9d8 commit d94822e

40 files changed

+57
-467
lines changed

packages/devtools-reps/src/reps/array.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// Dependencies
66
const React = require("react");
77
const {
8-
safeObjectLink,
98
wrapRender,
109
} = require("./rep-utils");
1110
const Caption = require("./caption");
@@ -25,7 +24,6 @@ const DOM = React.DOM;
2524
*/
2625
ArrayRep.propTypes = {
2726
mode: ModePropType,
28-
objectLink: React.PropTypes.func,
2927
object: React.PropTypes.array.isRequired,
3028
};
3129

@@ -53,14 +51,12 @@ function ArrayRep(props) {
5351
return (
5452
DOM.span({
5553
className: "objectBox objectBox-array"},
56-
safeObjectLink(props, {
54+
DOM.span({
5755
className: "arrayLeftBracket",
58-
object: object
5956
}, brackets.left),
6057
...items,
61-
safeObjectLink(props, {
58+
DOM.span({
6259
className: "arrayRightBracket",
63-
object: object
6460
}, brackets.right),
6561
DOM.span({
6662
className: "arrayProperties",
@@ -97,9 +93,7 @@ function arrayIterator(props, array, max) {
9793

9894
if (array.length > max) {
9995
items.push(Caption({
100-
object: safeObjectLink(props, {
101-
object: props.object
102-
}, "more…")
96+
object: DOM.span({}, "more…")
10397
}));
10498
}
10599

packages/devtools-reps/src/reps/attribute.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const React = require("react");
88
// Reps
99
const {
1010
isGrip,
11-
safeObjectLink,
1211
wrapRender,
1312
} = require("./rep-utils");
1413
const {rep: StringRep} = require("./string");
@@ -21,7 +20,6 @@ const { span } = React.DOM;
2120
*/
2221
Attribute.propTypes = {
2322
object: React.PropTypes.object.isRequired,
24-
objectLink: React.PropTypes.func,
2523
};
2624

2725
function Attribute(props) {
@@ -31,9 +29,9 @@ function Attribute(props) {
3129
let value = object.preview.value;
3230

3331
return (
34-
safeObjectLink(props, {
35-
className: "objectLink-Attr",
32+
span({
3633
"data-link-actor-id": object.actor,
34+
className: "objectLink-Attr"
3735
},
3836
span({className: "attrTitle"},
3937
getTitle(object)

packages/devtools-reps/src/reps/date-time.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const React = require("react");
88
// Reps
99
const {
1010
isGrip,
11-
safeObjectLink,
1211
wrapRender,
1312
} = require("./rep-utils");
1413

@@ -20,7 +19,6 @@ const { span } = React.DOM;
2019
*/
2120
DateTime.propTypes = {
2221
object: React.PropTypes.object.isRequired,
23-
objectLink: React.PropTypes.func,
2422
};
2523

2624
function DateTime(props) {
@@ -31,7 +29,7 @@ function DateTime(props) {
3129
"data-link-actor-id": grip.actor,
3230
className: "objectBox",
3331
},
34-
getTitle(props, grip),
32+
getTitle(grip),
3533
span({className: "Date"},
3634
new Date(grip.preview.timestamp).toISOString()
3735
)
@@ -43,8 +41,8 @@ function DateTime(props) {
4341
return date;
4442
}
4543

46-
function getTitle(props, grip) {
47-
return safeObjectLink(props, {}, grip.class + " ");
44+
function getTitle(grip) {
45+
return span({}, grip.class + " ");
4846
}
4947

5048
// Registration

packages/devtools-reps/src/reps/document.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const React = require("react");
99
const {
1010
isGrip,
1111
getURLDisplayString,
12-
safeObjectLink,
1312
wrapRender,
1413
} = require("./rep-utils");
1514

@@ -21,7 +20,6 @@ const { span } = React.DOM;
2120
*/
2221
Document.propTypes = {
2322
object: React.PropTypes.object.isRequired,
24-
objectLink: React.PropTypes.func,
2523
};
2624

2725
function Document(props) {
@@ -32,7 +30,7 @@ function Document(props) {
3230
"data-link-actor-id": grip.actor,
3331
className: "objectBox objectBox-object"
3432
},
35-
getTitle(props, grip),
33+
getTitle(grip),
3634
span({className: "objectPropValue"},
3735
getLocation(grip)
3836
)
@@ -45,8 +43,8 @@ function getLocation(grip) {
4543
return location ? getURLDisplayString(location) : "";
4644
}
4745

48-
function getTitle(props, grip) {
49-
return safeObjectLink(props, {}, grip.class + " ");
46+
function getTitle(grip) {
47+
return span({}, grip.class + " ");
5048
}
5149

5250
// Registration

packages/devtools-reps/src/reps/element-node.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const React = require("react");
88
// Utils
99
const {
1010
isGrip,
11-
safeObjectLink,
1211
wrapRender,
1312
} = require("./rep-utils");
1413
const { MODE } = require("./constants");
@@ -28,7 +27,6 @@ ElementNode.propTypes = {
2827
onDOMNodeMouseOver: React.PropTypes.func,
2928
onDOMNodeMouseOut: React.PropTypes.func,
3029
onInspectIconClick: React.PropTypes.func,
31-
objectLink: React.PropTypes.func,
3230
};
3331

3432
function ElementNode(props) {
@@ -73,7 +71,7 @@ function ElementNode(props) {
7371
}
7472

7573
return span(baseConfig,
76-
safeObjectLink(props, {}, ...elements),
74+
...elements,
7775
inspectIcon
7876
);
7977
}

packages/devtools-reps/src/reps/error.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@ const React = require("react");
77
// Utils
88
const {
99
isGrip,
10-
safeObjectLink,
1110
wrapRender,
1211
} = require("./rep-utils");
1312
const { MODE } = require("./constants");
1413

14+
// Shortcuts
15+
const { span } = React.DOM;
16+
1517
/**
1618
* Renders Error objects.
1719
*/
1820
ErrorRep.propTypes = {
1921
object: React.PropTypes.object.isRequired,
2022
// @TODO Change this to Object.values once it's supported in Node's version of V8
2123
mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])),
22-
objectLink: React.PropTypes.func,
2324
};
2425

2526
function ErrorRep(props) {
@@ -42,9 +43,9 @@ function ErrorRep(props) {
4243
content = `${content}\nStack trace:\n${preview.stack}`;
4344
}
4445

45-
return safeObjectLink(props, {
46+
return span({
4647
"data-link-actor-id": object.actor,
47-
className: "objectBox-stackTrace",
48+
className: "objectBox-stackTrace"
4849
}, content);
4950
}
5051

packages/devtools-reps/src/reps/event.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const { rep } = require("./grip");
1919
*/
2020
Event.propTypes = {
2121
object: React.PropTypes.object.isRequired,
22-
objectLink: React.PropTypes.func,
2322
// @TODO Change this to Object.values once it's supported in Node's version of V8
2423
mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])),
2524
onDOMNodeMouseOver: React.PropTypes.func,

packages/devtools-reps/src/reps/function.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const React = require("react");
99
const {
1010
isGrip,
1111
cropString,
12-
safeObjectLink,
1312
wrapRender,
1413
} = require("./rep-utils");
1514

@@ -21,7 +20,6 @@ const { span } = React.DOM;
2120
*/
2221
FunctionRep.propTypes = {
2322
object: React.PropTypes.object.isRequired,
24-
objectLink: React.PropTypes.func,
2523
parameterNames: React.PropTypes.array,
2624
};
2725

@@ -54,7 +52,7 @@ function getTitle(props, grip) {
5452
title = "async " + title;
5553
}
5654

57-
return safeObjectLink(props, {}, title);
55+
return span({}, title);
5856
}
5957

6058
function summarizeFunction(grip) {

packages/devtools-reps/src/reps/grip-array.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
const React = require("react");
77
const {
88
isGrip,
9-
safeObjectLink,
109
wrapRender,
1110
} = require("./rep-utils");
1211
const Caption = require("./caption");
@@ -24,7 +23,6 @@ GripArray.propTypes = {
2423
// @TODO Change this to Object.values once it's supported in Node's version of V8
2524
mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])),
2625
provider: React.PropTypes.object,
27-
objectLink: React.PropTypes.func,
2826
onDOMNodeMouseOver: React.PropTypes.func,
2927
onDOMNodeMouseOut: React.PropTypes.func,
3028
onInspectIconClick: React.PropTypes.func,
@@ -62,11 +60,11 @@ function GripArray(props) {
6260
"data-link-actor-id": object.actor,
6361
className: "objectBox objectBox-array"},
6462
title,
65-
safeObjectLink(props, {
63+
span({
6664
className: "arrayLeftBracket",
6765
}, brackets.left),
6866
...interleaveCommas(items),
69-
safeObjectLink(props, {
67+
span({
7068
className: "arrayRightBracket",
7169
}, brackets.right),
7270
span({
@@ -94,13 +92,13 @@ function getLength(grip) {
9492
return grip.preview.length || grip.preview.childNodesLength || 0;
9593
}
9694

97-
function getTitle(props, object, context) {
95+
function getTitle(props, object) {
9896
if (props.mode === MODE.TINY) {
9997
return "";
10098
}
10199

102100
let title = props.title || object.class || "Array";
103-
return safeObjectLink(props, {}, title + " ");
101+
return span({}, title + " ");
104102
}
105103

106104
function getPreviewItems(grip) {
@@ -176,7 +174,7 @@ function arrayIterator(props, grip, max) {
176174
const itemsShown = (items.length + foldedEmptySlots);
177175
if (gripLength > itemsShown) {
178176
items.push(Caption({
179-
object: safeObjectLink(props, {}, "more…")
177+
object: span({}, "more…")
180178
}));
181179
}
182180

packages/devtools-reps/src/reps/grip-map.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
const React = require("react");
77
const {
88
isGrip,
9-
safeObjectLink,
109
wrapRender,
1110
} = require("./rep-utils");
1211
const Caption = require("./caption");
@@ -23,7 +22,6 @@ GripMap.propTypes = {
2322
object: React.PropTypes.object,
2423
// @TODO Change this to Object.values once it's supported in Node's version of V8
2524
mode: React.PropTypes.oneOf(Object.keys(MODE).map(key => MODE[key])),
26-
objectLink: React.PropTypes.func,
2725
isInterestingEntry: React.PropTypes.func,
2826
onDOMNodeMouseOver: React.PropTypes.func,
2927
onDOMNodeMouseOut: React.PropTypes.func,
@@ -53,11 +51,11 @@ function GripMap(props) {
5351
return (
5452
span(config,
5553
getTitle(props, object),
56-
safeObjectLink(props, {
54+
span({
5755
className: "objectLeftBrace",
5856
}, " { "),
5957
...propsArray,
60-
safeObjectLink(props, {
58+
span({
6159
className: "objectRightBrace",
6260
}, " }")
6361
)
@@ -66,7 +64,7 @@ function GripMap(props) {
6664

6765
function getTitle(props, object) {
6866
let title = props.title || (object && object.class ? object.class : "Map");
69-
return safeObjectLink(props, {}, title);
67+
return span({}, title);
7068
}
7169

7270
function safeEntriesIterator(props, object, max) {
@@ -107,7 +105,7 @@ function entriesIterator(props, object, max) {
107105
// There are some undisplayed entries. Then display "more…".
108106
entries.push(Caption({
109107
key: "more",
110-
object: safeObjectLink(props, {}, "more…")
108+
object: span({}, "more…")
111109
}));
112110
}
113111

@@ -140,7 +138,6 @@ function unfoldEntries(items) {
140138
*/
141139
function getEntries(props, entries, indexes) {
142140
let {
143-
objectLink,
144141
onDOMNodeMouseOver,
145142
onDOMNodeMouseOut,
146143
onInspectIconClick,
@@ -156,12 +153,10 @@ function getEntries(props, entries, indexes) {
156153
let value = entryValue.value !== undefined ? entryValue.value : entryValue;
157154

158155
return PropRep({
159-
// key,
160156
name: key,
161157
equal: ": ",
162158
object: value,
163159
mode: MODE.TINY,
164-
objectLink,
165160
onDOMNodeMouseOver,
166161
onDOMNodeMouseOut,
167162
onInspectIconClick,

0 commit comments

Comments
 (0)