Skip to content

Commit 5b9b4e6

Browse files
id parameter with falsy value should not
be changed to string
1 parent 57dbd6a commit 5b9b4e6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/utils/api/api.factory.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ const _apiProps = {
5050
return new (Promise)(resolve => { this.one('_onFlushEffects', function () { resolve.apply(this, arguments); }); });
5151
},
5252
select: function (id = missingParamEr('select')) {
53-
id = id + '';//make sure id is string
53+
if (id)
54+
id = id + '';//make sure id is string
5455
const result = this._getOnChangePromise();
5556
this._select(id);
5657
return result;
@@ -84,7 +85,8 @@ const _apiProps = {
8485
return this;
8586
},
8687
open: function (tabObj = missingParamEr('open')) {
87-
tabObj.id = tabObj.id + '';//make sure id is string
88+
if (tabObj.id)
89+
tabObj.id = tabObj.id + '';//make sure id is string
8890
const result = this._getOnChangePromise();
8991
this._open(tabObj.id);
9092
this._addTab(tabObj, { defaultPanelComponent: this.getOption('defaultPanelComponent') });
@@ -97,7 +99,8 @@ const _apiProps = {
9799
return result;
98100
},
99101
close: function (id = missingParamEr('close')) {
100-
id = id + '';//make sure id is string
102+
if (id)
103+
id = id + '';//make sure id is string
101104
if (this.isSelected(id)) {
102105
const _openTabsId = [...this.stateRef.openTabIDs];
103106
_openTabsId.splice(_openTabsId.indexOf(id), 1);

0 commit comments

Comments
 (0)