Files
zerobyte/app/client/hooks/use-updates.ts
Nico d7bcf4c9e2 feat: display updates and release notes (#290)
* feat: display notification when new release is available

* refactor: standalone re-usable cache util

* refactor: clear cache on server startup

* refactor: add timeout to gh release fetch

* fix: run with app version env variable
2026-01-04 10:19:23 +01:00

19 lines
423 B
TypeScript

import { useQuery } from "@tanstack/react-query";
import { getUpdatesOptions } from "../api-client/@tanstack/react-query.gen";
export function useUpdates() {
const { data, isLoading, error } = useQuery({
...getUpdatesOptions(),
staleTime: 60 * 60 * 1000,
gcTime: 24 * 60 * 60 * 1000,
refetchOnWindowFocus: false,
});
return {
updates: data,
hasUpdate: data?.hasUpdate ?? false,
isLoading,
error,
};
}