detect leaderboard agent / game change and reset pagination
This commit is contained in:
parent
a41f8c5fd8
commit
9ede6580bc
|
@ -130,9 +130,11 @@ function MenuBar (props) {
|
||||||
|
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const handleGameJump = (gameName) => {
|
const handleGameJump = (gameName) => {
|
||||||
|
props.resetPagination();
|
||||||
history.push(`/leaderboard?type=game&name=${gameName}`);
|
history.push(`/leaderboard?type=game&name=${gameName}`);
|
||||||
}
|
}
|
||||||
const handleAgentJump = (agentName) => {
|
const handleAgentJump = (agentName) => {
|
||||||
|
props.resetPagination();
|
||||||
history.push(`/leaderboard?type=agent&name=${agentName}`);
|
history.push(`/leaderboard?type=agent&name=${agentName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,8 +71,6 @@ function LeaderBoard () {
|
||||||
}
|
}
|
||||||
console.log(requestUrl);
|
console.log(requestUrl);
|
||||||
|
|
||||||
// todo: detect type change then reset page and page size
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
const res = await axios.get(requestUrl);
|
const res = await axios.get(requestUrl);
|
||||||
|
@ -92,7 +90,13 @@ function LeaderBoard () {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<MenuBar gameList={gameList} modelList={modelList} reloadMenu={reloadMenu} setReloadMenu={setReloadMenu}/>
|
<MenuBar
|
||||||
|
gameList={gameList}
|
||||||
|
modelList={modelList}
|
||||||
|
reloadMenu={reloadMenu}
|
||||||
|
setReloadMenu={setReloadMenu}
|
||||||
|
resetPagination={() => {setPage(0); setRowsPerPage(initRowsPerPage);}}
|
||||||
|
/>
|
||||||
<div style={{marginLeft: '250px'}}>
|
<div style={{marginLeft: '250px'}}>
|
||||||
<div style={{padding: 20}}>
|
<div style={{padding: 20}}>
|
||||||
<EnhancedTable
|
<EnhancedTable
|
||||||
|
|
Loading…
Reference in New Issue