From 10d20e5963cb39d082a2d855bc03d424ae5ca1e3 Mon Sep 17 00:00:00 2001 From: Ali <83188384+testA113@users.noreply.github.com> Date: Fri, 26 Apr 2024 08:46:02 +1200 Subject: [PATCH] fix(version): reduce github requests [EE-7017] (#11677) --- app/react/portainer/system/useSystemVersion.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/react/portainer/system/useSystemVersion.ts b/app/react/portainer/system/useSystemVersion.ts index a141c9b3c..b4b38fa17 100644 --- a/app/react/portainer/system/useSystemVersion.ts +++ b/app/react/portainer/system/useSystemVersion.ts @@ -36,5 +36,9 @@ export async function getSystemVersion() { } export function useSystemVersion() { - return useQuery(queryKey, () => getSystemVersion()); + return useQuery(queryKey, () => getSystemVersion(), { + // 24 hour stale time to reduce the number of requests to avoid github api rate limits + // a hard refresh of the browser will still trigger a new request + staleTime: 24 * 60 * 60 * 1000, + }); }