fix: fix refresh not working properly (close #229)

This commit is contained in:
JustSong
2023-07-02 15:55:49 +08:00
parent f387cc5ead
commit 9ec6506c32
3 changed files with 8 additions and 8 deletions

View File

@@ -45,8 +45,8 @@ const TokensTable = () => {
if (startIdx === 0) {
setTokens(data);
} else {
let newTokens = tokens;
newTokens.push(...data);
let newTokens = [...tokens];
newTokens.splice(startIdx * ITEMS_PER_PAGE, data.length, ...data);
setTokens(newTokens);
}
} else {
@@ -67,7 +67,7 @@ const TokensTable = () => {
const refresh = async () => {
setLoading(true);
await loadTokens(0);
await loadTokens(activePage - 1);
}
useEffect(() => {