Skip to content

Commit 3a3bdc0

Browse files
update baseApi.js : rename _perviousData
and make it none enumerable
1 parent 82dfd80 commit 3a3bdc0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/useDynamicTabs/useDynamicTabs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function useDynamicTabs(getDeps, options = {}) {
2727
api.trigger('_onReady', api.userProxy);
2828
}, []);
2929
useLayoutEffect(() => {
30-
const oldState = api.getCopyPerviousData(),
30+
const oldState = api.previousState,
3131
[openedTabIDs, closedTabIDs] = api.helper.getArraysDiff(state.openTabIDs, oldState.openTabIDs),
3232
isSwitched = oldState.selectedTabID !== state.selectedTabID;
3333
api.onChange({newState: state, oldState, closedTabIDs, openedTabIDs, isSwitched});

src/utils/api/api.factory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const _apiProps = {
7878
return this.optionsManager.setOption(name, value);
7979
},
8080
getCopyPerviousData: function () {
81-
return this.helper.getCopyState(this._perviousState);
81+
return this.helper.getCopyState(this.previousState);
8282
},
8383
getCopyData: function () {
8484
return this.helper.getCopyState(this.stateRef);

src/utils/api/baseApi.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import Helper from '../helper.js';
33
function BaseApi({helper, initialState}) {
44
this._helper = helper;
55
this._state = this._helper.getCopyState(initialState); // it will be updated after each render
6-
this._perviousState = this._helper.getCopyState(initialState); // it is a pervious value of this._state
76
this._dispatch = null;
87
this._setFlushState = null;
98
this._isReady = false;
109
helper.setNoneEnumProps(this, {
1110
forceUpdateState: {},
11+
previousState: this._helper.getCopyState(initialState), // it is a previous value of this._state
1212
stateRef: {}, // have a same reference with state . It will be updated in each execution of useDynamicTabs.js
1313
});
1414
}
@@ -39,7 +39,7 @@ Helper.setNoneEnumProps(BaseApi.prototype, {
3939
return this;
4040
},
4141
updateState: function (state) {
42-
this._perviousState = this._helper.getCopyState(this._state);
42+
this.previousState = this._helper.getCopyState(this._state);
4343
this._state = this._helper.getCopyState(state);
4444
return this;
4545
},

0 commit comments

Comments
 (0)