Caching
This commit is contained in:
@@ -17,12 +17,21 @@ import { getDeployments } from "@/lib/dockship/deploy";
|
||||
import { useAsync, useAsyncInterval } from "@/hooks/use-async";
|
||||
|
||||
export default function OverviewPage() {
|
||||
const { value: nodes } = useAsyncInterval([], getLiveNodes, 3000);
|
||||
const { value: dockerNodes } = useAsync([], async () => getDocker(nodes), [
|
||||
nodes,
|
||||
]);
|
||||
const { value: apps } = useAsyncInterval([], getApps, 3000);
|
||||
const { value: nodes } = useAsyncInterval(
|
||||
"liveNodes",
|
||||
[],
|
||||
getLiveNodes,
|
||||
3000,
|
||||
);
|
||||
const { value: dockerNodes } = useAsync(
|
||||
"docker",
|
||||
[],
|
||||
async () => getDocker(nodes),
|
||||
[nodes],
|
||||
);
|
||||
const { value: apps } = useAsyncInterval("apps", [], getApps, 3000);
|
||||
const { value: deployments } = useAsyncInterval(
|
||||
"deployments",
|
||||
[],
|
||||
async () => (await getDeployments()).filter((d) => d !== null),
|
||||
3000,
|
||||
|
||||
Reference in New Issue
Block a user