Skip to content

Commit af69044

Browse files
committed
style: rename getDerivedStateFromProps to getDerivedState
1 parent 04b7d3a commit af69044

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

components/vc-select/Select.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ const Select = {
161161
return {
162162
...state,
163163
_mirrorInputValue: state._inputValue, // https://github.com/vueComponent/ant-design-vue/issues/1458
164-
...this.getDerivedStateFromProps(props, state),
164+
...this.getDerivedState(props, state),
165165
};
166166
},
167167

@@ -179,7 +179,7 @@ const Select = {
179179
},
180180
watch: {
181181
__propsSymbol__() {
182-
Object.assign(this.$data, this.getDerivedStateFromProps(getOptionProps(this), this.$data));
182+
Object.assign(this.$data, this.getDerivedState(getOptionProps(this), this.$data));
183183
},
184184
'$data._inputValue'(val) {
185185
this.$data._mirrorInputValue = val;
@@ -210,7 +210,7 @@ const Select = {
210210
}
211211
},
212212
methods: {
213-
getDerivedStateFromProps(nextProps, prevState) {
213+
getDerivedState(nextProps, prevState) {
214214
const optionsInfo = prevState._skipBuildOptionsInfo
215215
? prevState._optionsInfo
216216
: this.getOptionsInfoFromProps(nextProps, prevState);

components/vc-tree-select/src/Base/BasePopup.jsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { createRef } from '../util';
99
// onTreeNodeSelect: PropTypes.func.isRequired,
1010
// onTreeNodeCheck: PropTypes.func.isRequired,
1111
// }
12-
function getDerivedStateFromProps(nextProps, prevState) {
12+
function getDerivedState(nextProps, prevState) {
1313
const {
1414
_prevProps: prevProps = {},
1515
_loadedKeys: loadedKeys,
@@ -106,7 +106,7 @@ const BasePopup = {
106106
},
107107
watch: {
108108
__propsSymbol__() {
109-
const state = getDerivedStateFromProps(this.$props, this.$data);
109+
const state = getDerivedState(this.$props, this.$data);
110110
this.setState(state);
111111
},
112112
},
@@ -124,14 +124,14 @@ const BasePopup = {
124124
const state = {
125125
_keyList: [],
126126
_expandedKeyList: expandedKeyList,
127-
// Cache `expandedKeyList` when tree is in filter. This is used in `getDerivedStateFromProps`
127+
// Cache `expandedKeyList` when tree is in filter. This is used in `getDerivedState`
128128
_cachedExpandedKeyList: [],
129129
_loadedKeys: [],
130130
_prevProps: {},
131131
};
132132
return {
133133
...state,
134-
...getDerivedStateFromProps(this.$props, state),
134+
...getDerivedState(this.$props, state),
135135
};
136136
},
137137
methods: {

components/vc-tree-select/src/Select.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ const Select = {
187187
_treeNodes: undefined,
188188
_filteredTreeNodes: undefined,
189189
};
190-
const newState = this.getDerivedStateFromProps(this.$props, state);
190+
const newState = this.getDerivedState(this.$props, state);
191191
return {
192192
...state,
193193
...newState,
@@ -215,7 +215,7 @@ const Select = {
215215
watch: {
216216
...getWatch(['treeData', 'defaultValue', 'value']),
217217
__propsSymbol__() {
218-
const state = this.getDerivedStateFromProps(this.$props, this.$data);
218+
const state = this.getDerivedState(this.$props, this.$data);
219219
this.setState(state);
220220
this.needSyncKeys = {};
221221
},
@@ -266,7 +266,7 @@ const Select = {
266266
},
267267

268268
methods: {
269-
getDerivedStateFromProps(nextProps, prevState) {
269+
getDerivedState(nextProps, prevState) {
270270
const h = this.$createElement;
271271
const { _prevProps: prevProps = {} } = prevState;
272272
const {

components/vc-tree/src/Tree.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ const Tree = {
128128
};
129129
return {
130130
...state,
131-
...this.getDerivedStateFromProps(getOptionProps(this), state),
131+
...this.getDerivedState(getOptionProps(this), state),
132132
};
133133
},
134134
provide() {
@@ -148,13 +148,13 @@ const Tree = {
148148
'loadedKeys',
149149
]),
150150
__propsSymbol__() {
151-
this.setState(this.getDerivedStateFromProps(getOptionProps(this), this.$data));
151+
this.setState(this.getDerivedState(getOptionProps(this), this.$data));
152152
this.needSyncKeys = {};
153153
},
154154
},
155155

156156
methods: {
157-
getDerivedStateFromProps(props, prevState) {
157+
getDerivedState(props, prevState) {
158158
const { _prevProps } = prevState;
159159
const newState = {
160160
_prevProps: { ...props },

0 commit comments

Comments
 (0)