Skip to content

Commit 9892ccd

Browse files
committed
Remove unused options
The inspector used to support filtering out components in the view tab, and there are a lot of supporting code for that. Since the view tab was removed, there is no longer any way to set this option, and it is always true in practice.
1 parent ecac99c commit 9892ccd

5 files changed

Lines changed: 8 additions & 40 deletions

File tree

app/controllers/component-tree.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ export default Controller.extend({
9898
*/
9999
pinnedObjectId: null,
100100
inspectingViews: false,
101-
components: true,
102101
viewTreeLoaded: false,
103102

104103
/**
@@ -159,9 +158,6 @@ export default Controller.extend({
159158
init() {
160159
this._super(...arguments);
161160
this.set('expandedStateCache', {});
162-
this.options = {
163-
components: true
164-
};
165161
},
166162

167163
/**

app/routes/component-tree.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export default TabRoute.extend({
1919
this.port.on('view:inspectDOMNode', this, this.inspectDOMNode);
2020

2121
this.set('controller.viewTreeLoaded', false);
22-
this.port.send('view:setOptions', { options: this.get('controller.options') });
2322
this.port.send('view:getTree');
2423
},
2524

ember_debug/libs/glimmer-tree.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export default class {
4343
* @param {Object} options
4444
* - {owner} owner The Ember app's owner.
4545
* - {Function} retainObject Called to retain an object for future inspection.
46-
* - {Object} options Options whether to show components or not.
4746
* - {Object} durations Hash containing time to render per view id.
4847
* - {Function} highlightRange Called to highlight a range of elements.
4948
* - {Object} ObjectInspector Used to inspect models.
@@ -52,29 +51,19 @@ export default class {
5251
constructor({
5352
owner,
5453
retainObject,
55-
options,
5654
durations,
5755
highlightRange,
5856
objectInspector,
5957
viewRegistry
6058
}) {
6159
this.owner = owner;
6260
this.retainObject = retainObject;
63-
this.options = options;
6461
this.durations = durations;
6562
this.highlightRange = highlightRange;
6663
this.objectInspector = objectInspector;
6764
this.viewRegistry = viewRegistry;
6865
}
6966

70-
/**
71-
* @method updateOptions
72-
* @param {Object} options
73-
*/
74-
updateOptions(options) {
75-
this.options = options;
76-
}
77-
7867
/**
7968
* @method updateDurations
8069
* @param {Object} durations
@@ -84,8 +73,7 @@ export default class {
8473
}
8574

8675
/**
87-
* Builds the view tree. The view tree may or may not contain
88-
* components depending on the current options.
76+
* Builds the view tree.
8977
*
9078
* The view tree has the top level outlet as the root of the tree.
9179
* The format is:
@@ -114,7 +102,7 @@ export default class {
114102
build() {
115103
if (this.getRoot()) {
116104
let outletTree = this.buildOutletTree();
117-
let componentTrees = this.options.components ? this.buildComponentTrees(outletTree) : [];
105+
let componentTrees = this.buildComponentTrees(outletTree);
118106
return this.addComponentsToOutlets(outletTree, componentTrees);
119107
}
120108
}

ember_debug/view-debug.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,7 @@ export default EmberObject.extend(PortMixin, {
7575
this.inspectElement(element);
7676
}
7777
},
78-
setOptions({ options }) {
79-
this.set('options', options);
80-
this.glimmerTree.updateOptions(options);
81-
this.sendTree();
82-
},
78+
8379
sendModelToConsole(message) {
8480
const model = this.glimmerTree.modelForViewNodeValue(message);
8581

@@ -96,7 +92,6 @@ export default EmberObject.extend(PortMixin, {
9692
this._super(...arguments);
9793

9894
this.retainedObjects = [];
99-
this.options = {};
10095
this._durations = {};
10196
layerDiv = document.createElement('div');
10297
layerDiv.setAttribute('data-label', 'layer-div');
@@ -126,7 +121,6 @@ export default EmberObject.extend(PortMixin, {
126121
owner: this.getOwner(),
127122
retainObject: this.retainObject.bind(this),
128123
highlightRange: this._highlightRange.bind(this),
129-
options: this.get('options'),
130124
objectInspector: this.get('objectInspector'),
131125
durations: this._durations,
132126
viewRegistry: this.get('viewRegistry')
@@ -305,10 +299,11 @@ export default EmberObject.extend(PortMixin, {
305299

306300
shouldShowView(view) {
307301
if (view instanceof Component) {
308-
return this.options.components;
302+
return true;
303+
} else {
304+
return (this.hasOwnController(view) || this.hasOwnContext(view)) &&
305+
(!view.get('isVirtual') || this.hasOwnController(view) || this.hasOwnContext(view));
309306
}
310-
return (this.hasOwnController(view) || this.hasOwnContext(view)) &&
311-
(!view.get('isVirtual') || this.hasOwnController(view) || this.hasOwnContext(view));
312307
},
313308

314309
hasOwnController(view) {
@@ -548,7 +543,6 @@ export default EmberObject.extend(PortMixin, {
548543
return false;
549544
}
550545
return this._nodeHasOwnController(renderNode, parentNode) &&
551-
(this.options.components || !(this._nodeIsEmberComponent(renderNode))) &&
552546
(this._nodeHasViewInstance(renderNode) || this._nodeHasOwnController(renderNode, parentNode));
553547
},
554548

tests/ember_debug/view-debug-test.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,7 @@ module('Ember Debug - View', function(hooks) {
147147

148148
let tree = message.tree;
149149
let simple = tree.children[0];
150-
assert.equal(simple.children.length, 0, 'Components are not listed by default.');
151-
run(() => {
152-
port.trigger('view:setOptions', { options: { components: true } });
153-
});
154-
155-
await settled();
156-
157-
tree = message.tree;
158-
simple = tree.children[0];
159-
assert.equal(simple.children.length, 1, 'Components can be configured to show.');
150+
assert.equal(simple.children.length, 1, 'Components are shown.');
160151
let component = simple.children[0];
161152
assert.equal(component.value.viewClass, 'App.TestFooComponent');
162153
});

0 commit comments

Comments
 (0)