Select 去掉 cache 功能,因为 api 本身就具备 cache 功能

This commit is contained in:
liaoxuezhi 2019-12-09 17:46:06 +08:00
parent 992d501954
commit f8bc3fcfe1

View File

@ -21,9 +21,6 @@ export default class SelectControl extends React.Component<SelectProps, any> {
};
input: any;
cache: {
[propName: string]: any;
} = {};
unHook: Function;
constructor(props: SelectProps) {
super(props);
@ -133,15 +130,6 @@ export default class SelectControl extends React.Component<SelectProps, any> {
return (this.unHook = addHook(this.loadRemote.bind(this, input), 'init'));
}
if (this.cache[input]) {
let options = this.cache[input] || [];
let combinedOptions = this.mergeOptions(options);
setOptions(combinedOptions);
return Promise.resolve({
options: combinedOptions
});
}
const ctx = createObject(data, {
term: input,
value: input
@ -158,7 +146,6 @@ export default class SelectControl extends React.Component<SelectProps, any> {
.fetcher(autoComplete, ctx)
.then(ret => {
let options = (ret.data && (ret.data as any).options) || ret.data || [];
this.cache[input] = options;
let combinedOptions = this.mergeOptions(options);
setOptions(combinedOptions);