mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-21 19:52:47 +02:00
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user