Fix refresh buttons and dont auto refresh

Fixes #3560
This commit is contained in:
Owen
2026-08-13 16:57:30 -04:00
parent 36c7c5dc34
commit 978fa8bfc6
6 changed files with 90 additions and 71 deletions
+18 -1
View File
@@ -149,6 +149,23 @@ export default function GeneralPage() {
setCurrentPage(newPage);
};
const handleRefresh = () => {
// When the end date has no explicit time, it represents an
// open-ended "up to now" upper bound. Since dateRange is only
// recomputed on user interaction, that upper bound otherwise stays
// frozen at whenever the page first loaded, so refreshing would
// never surface logs created since then. Bump it to the current
// time so the query key changes and refetches the latest window.
if (dateRange.endDate?.date && !dateRange.endDate.time) {
setDateRange((prev) => ({
...prev,
endDate: { date: new Date() }
}));
} else {
refetch();
}
};
const handlePageSizeChange = (newPageSize: number) => {
setPageSize(newPageSize);
setCurrentPage(0);
@@ -492,7 +509,7 @@ export default function GeneralPage() {
columns={columns}
data={rows}
title={t("accessLogs")}
onRefresh={() => refetch()}
onRefresh={handleRefresh}
isRefreshing={isFetching}
onExport={() => startTransition(exportData)}
isExporting={isExporting}
+18 -1
View File
@@ -135,6 +135,23 @@ export default function GeneralPage() {
setCurrentPage(newPage);
};
const handleRefresh = () => {
// When the end date has no explicit time, it represents an
// open-ended "up to now" upper bound. Since dateRange is only
// recomputed on user interaction, that upper bound otherwise stays
// frozen at whenever the page first loaded, so refreshing would
// never surface logs created since then. Bump it to the current
// time so the query key changes and refetches the latest window.
if (dateRange.endDate?.date && !dateRange.endDate.time) {
setDateRange((prev) => ({
...prev,
endDate: { date: new Date() }
}));
} else {
refetch();
}
};
const handlePageSizeChange = (newPageSize: number) => {
setPageSize(newPageSize);
setCurrentPage(0);
@@ -340,7 +357,7 @@ export default function GeneralPage() {
title={t("actionLogs")}
searchPlaceholder={t("searchLogs")}
searchColumn="action"
onRefresh={() => refetch()}
onRefresh={handleRefresh}
isRefreshing={isFetching}
onExport={() => startTransition(exportData)}
isExporting={isExporting}
+18 -1
View File
@@ -158,6 +158,23 @@ export default function AiSessionLogsPage() {
setCurrentPage(newPage);
};
const handleRefresh = () => {
// When the end date has no explicit time, it represents an
// open-ended "up to now" upper bound. Since dateRange is only
// recomputed on user interaction, that upper bound otherwise stays
// frozen at whenever the page first loaded, so refreshing would
// never surface logs created since then. Bump it to the current
// time so the query key changes and refetches the latest window.
if (dateRange.endDate?.date && !dateRange.endDate.time) {
setDateRange((prev) => ({
...prev,
endDate: { date: new Date() }
}));
} else {
refetch();
}
};
const handlePageSizeChange = (newPageSize: number) => {
setPageSize(newPageSize);
setCurrentPage(0);
@@ -617,7 +634,7 @@ export default function AiSessionLogsPage() {
title={t("aiSessionLogs")}
searchPlaceholder={t("searchLogs")}
searchColumn="providerName"
onRefresh={() => refetch()}
onRefresh={handleRefresh}
isRefreshing={isFetching}
onExport={() => startTransition(exportData)}
isExporting={isExporting}
@@ -170,6 +170,23 @@ export default function ConnectionLogsPage() {
setCurrentPage(newPage);
};
const handleRefresh = () => {
// When the end date has no explicit time, it represents an
// open-ended "up to now" upper bound. Since dateRange is only
// recomputed on user interaction, that upper bound otherwise stays
// frozen at whenever the page first loaded, so refreshing would
// never surface logs created since then. Bump it to the current
// time so the query key changes and refetches the latest window.
if (dateRange.endDate?.date && !dateRange.endDate.time) {
setDateRange((prev) => ({
...prev,
endDate: { date: new Date() }
}));
} else {
refetch();
}
};
const handlePageSizeChange = (newPageSize: number) => {
setPageSize(newPageSize);
setCurrentPage(0);
@@ -561,7 +578,7 @@ export default function ConnectionLogsPage() {
title={t("connectionLogs")}
searchPlaceholder={t("searchLogs")}
searchColumn="protocol"
onRefresh={() => refetch()}
onRefresh={handleRefresh}
isRefreshing={isFetching}
onExport={() => startTransition(exportData)}
isExporting={isExporting}
+18 -1
View File
@@ -151,6 +151,23 @@ export default function GeneralPage() {
setCurrentPage(newPage);
};
const handleRefresh = () => {
// When the end date has no explicit time, it represents an
// open-ended "up to now" upper bound. Since dateRange is only
// recomputed on user interaction, that upper bound otherwise stays
// frozen at whenever the page first loaded, so refreshing would
// never surface logs created since then. Bump it to the current
// time so the query key changes and refetches the latest window.
if (dateRange.endDate?.date && !dateRange.endDate.time) {
setDateRange((prev) => ({
...prev,
endDate: { date: new Date() }
}));
} else {
refetch();
}
};
const handlePageSizeChange = (newPageSize: number) => {
setPageSize(newPageSize);
setCurrentPage(0);
@@ -663,7 +680,7 @@ export default function GeneralPage() {
title={t("requestLogs")}
searchPlaceholder={t("searchLogs")}
searchColumn="host"
onRefresh={() => refetch()}
onRefresh={handleRefresh}
isRefreshing={isFetching}
onExport={() => startTransition(exportData)}
isExporting={isExporting}
-66
View File
@@ -1114,12 +1114,6 @@ export const logQueries = {
signal
});
return res.data.data;
},
refetchInterval: (query) => {
if (query.state.data) {
return durationToMs(30, "seconds");
}
return false;
}
}),
@@ -1145,12 +1139,6 @@ export const logQueries = {
signal
});
return res.data.data;
},
refetchInterval: (query) => {
if (query.state.data) {
return durationToMs(30, "seconds");
}
return false;
}
}),
@@ -1176,12 +1164,6 @@ export const logQueries = {
signal
});
return res.data.data;
},
refetchInterval: (query) => {
if (query.state.data) {
return durationToMs(30, "seconds");
}
return false;
}
}),
@@ -1207,12 +1189,6 @@ export const logQueries = {
signal
});
return res.data.data;
},
refetchInterval: (query) => {
if (query.state.data) {
return durationToMs(30, "seconds");
}
return false;
}
}),
@@ -1238,12 +1214,6 @@ export const logQueries = {
signal
});
return res.data.data;
},
refetchInterval: (query) => {
if (query.state.data) {
return durationToMs(30, "seconds");
}
return false;
}
}),
@@ -1269,12 +1239,6 @@ export const logQueries = {
signal
});
return res.data.data;
},
refetchInterval: (query) => {
if (query.state.data) {
return durationToMs(30, "seconds");
}
return false;
}
})
};
@@ -1327,12 +1291,6 @@ export const aiUsageAnalyticsQueries = {
signal
});
return res.data.data;
},
refetchInterval: (query) => {
if (query.state.data) {
return durationToMs(30, "seconds");
}
return false;
}
}),
@@ -1358,12 +1316,6 @@ export const aiUsageAnalyticsQueries = {
signal
});
return res.data.data;
},
refetchInterval: (query) => {
if (query.state.data) {
return durationToMs(30, "seconds");
}
return false;
}
}),
@@ -1389,12 +1341,6 @@ export const aiUsageAnalyticsQueries = {
signal
});
return res.data.data;
},
refetchInterval: (query) => {
if (query.state.data) {
return durationToMs(30, "seconds");
}
return false;
}
}),
@@ -1420,12 +1366,6 @@ export const aiUsageAnalyticsQueries = {
signal
});
return res.data.data;
},
refetchInterval: (query) => {
if (query.state.data) {
return durationToMs(30, "seconds");
}
return false;
}
}),
@@ -1451,12 +1391,6 @@ export const aiUsageAnalyticsQueries = {
signal
});
return res.data.data;
},
refetchInterval: (query) => {
if (query.state.data) {
return durationToMs(30, "seconds");
}
return false;
}
})
};