New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(table): column配置不写key,使用request方法出现错误 #3816
Conversation
这个功能还是挺常见的 const columns = [
{
// 需要添加key属性
key:'type',
title: '类型',
dataIndex: 'type',
valueType: 'select',
param: {},
request: async()=>[],
},
]; |
这个改动有点没看懂,有相关的issue 吗? |
{
title: '类型',
dataIndex: 'type',
valueType: 'select',
param: {},
request: async()=>[],
} 如果我不写key这个属性
proFieldKey 为undefined export const useFieldFetchData = (
props: FieldSelectProps & {
proFieldKey?: React.Key;
},
): [boolean, SelectProps<any>['options'], (keyWord?: string) => void, () => void] => {
const [keyWords, setKeyWords] = useState<string | undefined>(undefined);
// 这里就没有key 就出出现问题
field select
/** Key 是用来缓存请求的,如果不在是有问题 */
const [cacheKey] = useState(() => {
if (props.proFieldKey) {
return props.proFieldKey.toString();
}
if (props.request) {
testId += 1;
return testId.toString();
}
return 'no-fetch';
}); |
如果没有解释清楚的话 我可以提供一个小的demo |
1 similar comment
了解了,判断的确是不健壮 |
Codecov Report
@@ Coverage Diff @@
## master #3816 +/- ##
=======================================
Coverage 98.98% 98.98%
=======================================
Files 179 179
Lines 5810 5816 +6
Branches 2085 2091 +6
=======================================
+ Hits 5751 5757 +6
Misses 59 59
Continue to review full report at Codecov.
|
使用request方法table渲染时会造成数据重复请求
使用request方法table渲染数据出现错误