From 615d89ee0cb2bbed80a29a65919bba834b96d5cd Mon Sep 17 00:00:00 2001 From: HarikrishnanD Date: Fri, 7 Nov 2025 11:40:30 +0530 Subject: [PATCH] feat(requests): conditionally render traefik reload warning --- .../dashboard/requests/show-requests.tsx | 41 ++++++++++++++----- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/apps/dokploy/components/dashboard/requests/show-requests.tsx b/apps/dokploy/components/dashboard/requests/show-requests.tsx index ab602f463..974d4fb3f 100644 --- a/apps/dokploy/components/dashboard/requests/show-requests.tsx +++ b/apps/dokploy/components/dashboard/requests/show-requests.tsx @@ -59,6 +59,25 @@ export const ShowRequests = () => { to: undefined, }); + // Check if logs exist to determine if traefik has been reloaded + // Only fetch when active to minimize network calls + const { data: statsLogsCheck } = api.settings.readStatsLogs.useQuery( + { + page: { + pageIndex: 0, + pageSize: 1, + }, + }, + { + enabled: !!isActive, + refetchInterval: 5000, // Check every 5 seconds when active + }, + ); + + // Determine if warning should be shown + // Show warning only if active but no logs exist yet + const shouldShowWarning = isActive && (statsLogsCheck?.totalCount ?? 0) === 0; + useEffect(() => { if (logCleanupStatus) { setCronExpression(logCleanupStatus.cronExpression || "0 0 * * *"); @@ -79,16 +98,18 @@ export const ShowRequests = () => { See all the incoming requests that pass trough Traefik - - When you activate, you need to reload traefik to apply the - changes, you can reload traefik in{" "} - - Settings - - + {shouldShowWarning && ( + + When you activate, you need to reload traefik to apply the + changes, you can reload traefik in{" "} + + Settings + + + )}