fix(table): 统一筛选交互并补齐移动视口覆盖
This commit is contained in:
@@ -202,7 +202,7 @@ export const useMjLogsData = () => {
|
||||
|
||||
// Load logs function
|
||||
const listRequestIdRef = useRef(0);
|
||||
const loadLogs = async (page = 1, size = pageSize) => {
|
||||
const loadLogs = async (page = 1, size = pageSize, signal) => {
|
||||
const requestId = ++listRequestIdRef.current;
|
||||
setLoading(true);
|
||||
const { channel_id, mj_id, start_timestamp, end_timestamp } =
|
||||
@@ -213,16 +213,17 @@ export const useMjLogsData = () => {
|
||||
? `/api/mj/?p=${page}&page_size=${size}&channel_id=${channel_id}&mj_id=${mj_id}&start_timestamp=${localStartTimestamp}&end_timestamp=${localEndTimestamp}`
|
||||
: `/api/mj/self/?p=${page}&page_size=${size}&mj_id=${mj_id}&start_timestamp=${localStartTimestamp}&end_timestamp=${localEndTimestamp}`;
|
||||
try {
|
||||
const res = await API.get(url);
|
||||
if (requestId !== listRequestIdRef.current) return;
|
||||
const res = await API.get(url, { signal });
|
||||
if (requestId !== listRequestIdRef.current || signal?.aborted) return;
|
||||
const { success, message, data } = res.data;
|
||||
if (success) {
|
||||
syncPageData(data);
|
||||
if (signal) setActivePage(page);
|
||||
} else {
|
||||
showError(message);
|
||||
}
|
||||
} catch (error) {
|
||||
if (requestId === listRequestIdRef.current) {
|
||||
if (requestId === listRequestIdRef.current && !signal?.aborted) {
|
||||
showError(error.message || error);
|
||||
}
|
||||
} finally {
|
||||
@@ -241,8 +242,8 @@ export const useMjLogsData = () => {
|
||||
};
|
||||
|
||||
// Refresh function
|
||||
const refresh = async () => {
|
||||
await loadLogs(1, pageSize);
|
||||
const refresh = async ({ page = 1, signal } = {}) => {
|
||||
await loadLogs(page, pageSize, signal);
|
||||
};
|
||||
|
||||
// Copy text function
|
||||
|
||||
Reference in New Issue
Block a user