Skip to content

Commit eda2b42

Browse files
Merge pull request #56 from jonathannewman/maint/main/avoid-unexpected-selection-updates
(maint) avoid calling "onSelect" when the tab is already selected
2 parents 9a9afa0 + b49434e commit eda2b42

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

addon/components/ivy-tabs-tab.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export default class IvyTabsTabComponent extends Component {
105105
select() {
106106
const onSelect = this.args.onSelect;
107107
if (
108+
!this.isSelected &&
108109
!this.isDestroying &&
109110
!this.isDestroyed &&
110111
typeof onSelect === 'function'

tests/dummy/app/controllers/dynamic-tabs.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ export default class DynamicTabsController extends Controller {
2828

2929
@action
3030
updateDynamicSelection(item) {
31-
if (this.selection !== item) {
32-
this.selection = item;
33-
}
31+
this.selection = item;
3432
}
3533

3634
get checkedItems() {

tests/dummy/app/controllers/query-params.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ export default class QueryParamsController extends Controller {
1111

1212
@action
1313
updateQuerySelection(newValue) {
14-
if (this.selection !== newValue) {
15-
this.selection = newValue;
16-
}
14+
this.selection = newValue;
1715
}
1816
}

0 commit comments

Comments
 (0)