Skip to content

Commit

Permalink
Merge pull request #81 from umijs/fix/useAntdTableBug
Browse files Browse the repository at this point in the history
fix: 修复 useAntdTable useAsync deps bug
  • Loading branch information
brickspert authored Sep 30, 2019
2 parents fb4bf37 + 037cf0d commit d8cb360
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/useAntdTable/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import useAntdTable from './';
const [gender, setGender] = useState();

const getTableData = ({ current, pageSize }) => {
console.log(current, pageSize);
console.log(current, pageSize, gender);
return fetch(`https://randomuser.me/api?results=55&page=${current}&size=${pageSize}&gender=${gender}`)
.then(res => {
return res.json();
Expand Down Expand Up @@ -81,7 +81,7 @@ import useAntdTable from './';

return (
<>
<Select style={{ width: 180, marginBottom: 24 }} onChange={setGender} placeholder='性别筛选' allowClear>
<Select style={{ width: 180, marginBottom: 24 }} onChange={(g)=>setGender(g)} placeholder='性别筛选' allowClear>
<Option value="male">male</Option>
<Option value="female">female</Option>
</Select>
Expand Down
2 changes: 1 addition & 1 deletion src/useAntdTable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default function useAntdTable<Result, Item>(

const stateRef = useRef<UseTableInitState>(({} as unknown) as UseTableInitState);
stateRef.current = state;
const { run, loading } = useAsync(fn, [], {
const { run, loading } = useAsync(fn, deps, {
manual: true,
});

Expand Down

0 comments on commit d8cb360

Please sign in to comment.