fix(client): TypeError: Cannot read properties of null (reading 'setSelectedRows')

This commit is contained in:
chenos 2021-11-09 17:10:36 +08:00
parent 7a35638eda
commit 749ea00058

View File

@ -243,7 +243,7 @@ Select.Object = connect(
const OptionTagContext = createContext(null); const OptionTagContext = createContext(null);
const SelectedRowsContext = createContext<any>(null); const SelectedRowsContext = createContext<any>({});
Select.useOkAction = () => { Select.useOkAction = () => {
const { props } = useContext(SelectContext); const { props } = useContext(SelectContext);
@ -266,7 +266,7 @@ Select.useRowSelection = () => {
Select.useSelect = () => { Select.useSelect = () => {
const { setSelectedRows } = useContext(SelectedRowsContext); const { setSelectedRows } = useContext(SelectedRowsContext);
return (keys, rows) => { return (keys, rows) => {
setSelectedRows(rows); setSelectedRows && setSelectedRows(rows);
console.log('Select.onSelect', keys, rows); console.log('Select.onSelect', keys, rows);
}; };
}; };