Skip to content

Commit a14f7fe

Browse files
committed
selection.Model: deselect() => accessing the view variable before definition #6681
1 parent cdb9157 commit a14f7fe

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/selection/Model.mjs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,15 @@ class Model extends Base {
9494
* @param {String} [selectedCls]
9595
*/
9696
deselect(item, silent, itemCollection=this.items, selectedCls) {
97+
let me = this,
98+
{view} = me,
99+
node;
100+
97101
// We hold vdom ids for now, so all incoming selections must be converted.
98102
item = item.isRecord ? view.getItemId(item) : Neo.isObject(item) ? item.id : item;
99103

100104
if (itemCollection.includes(item)) {
101-
let me = this,
102-
{view} = me,
103-
node = view.getVdomChild(item);
105+
node = view.getVdomChild(item);
104106

105107
if (node) {
106108
node.cls = NeoArray.remove(node.cls || [], selectedCls || me.selectedCls);
@@ -119,9 +121,8 @@ class Model extends Base {
119121
selection: itemCollection
120122
})
121123
}
122-
}
123-
else if (!silent) {
124-
this.fire('noChange')
124+
} else if (!silent) {
125+
me.fire('noChange')
125126
}
126127
}
127128

@@ -146,8 +147,7 @@ class Model extends Base {
146147
me.fire('selectionChange', {
147148
selection: this.items
148149
})
149-
}
150-
else if (!silent) {
150+
} else if (!silent) {
151151
me.fire('noChange')
152152
}
153153
}

0 commit comments

Comments
 (0)