fixs bugsgagaga

This commit is contained in:
wood 2023-11-18 05:58:01 +08:00
parent ba269a3c61
commit ae006941c0

View File

@ -110,7 +110,6 @@ const ChannelsTable = () => {
newChannels.splice(startIdx * ITEMS_PER_PAGE, fetchedChannels.length, ...fetchedChannels); newChannels.splice(startIdx * ITEMS_PER_PAGE, fetchedChannels.length, ...fetchedChannels);
setChannels(newChannels); setChannels(newChannels);
} }
fetchMonthlyQuotasAndChannels(fetchedChannels); // 在这里调用函数 fetchMonthlyQuotasAndChannels(fetchedChannels); // 在这里调用函数
} else { } else {
showError(message); showError(message);
@ -118,7 +117,6 @@ const ChannelsTable = () => {
setLoading(false); setLoading(false);
}; };
// 翻页
const onPaginationChange = (e, { activePage }) => { const onPaginationChange = (e, { activePage }) => {
(async () => { (async () => {
if (activePage === Math.ceil(channels.length / ITEMS_PER_PAGE) + 1) { if (activePage === Math.ceil(channels.length / ITEMS_PER_PAGE) + 1) {
@ -126,7 +124,6 @@ const ChannelsTable = () => {
await loadChannels(activePage - 1); await loadChannels(activePage - 1);
} }
setActivePage(activePage); setActivePage(activePage);
await refresh();
})(); })();
}; };
@ -142,6 +139,12 @@ const ChannelsTable = () => {
showError(reason); showError(reason);
}); });
}, []); }, []);
// 监听频道列表变化
useEffect(() => {
if (channels.length > 0) {
fetchMonthlyQuotasAndChannels(channels);
}
}, [channels]);