From b76ead3fe80a6159fdbfcc9b82c7c6318be68e7f Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Thu, 12 Mar 2026 16:10:52 +0800 Subject: refactor(desktop): rework default server initialization and connection handling (#16965) --- packages/app/src/utils/server-health.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'packages/app/src/utils') diff --git a/packages/app/src/utils/server-health.ts b/packages/app/src/utils/server-health.ts index db4aa89bd..45a323c7b 100644 --- a/packages/app/src/utils/server-health.ts +++ b/packages/app/src/utils/server-health.ts @@ -1,3 +1,4 @@ +import { usePlatform } from "@/context/platform" import type { ServerConnection } from "@/context/server" import { createSdkForServer } from "./server" @@ -81,3 +82,10 @@ export async function checkServerHealth( .catch((error) => next(count, error)) return attempt(0).finally(() => timeout?.clear?.()) } + +export function useCheckServerHealth() { + const platform = usePlatform() + const fetcher = platform.fetch ?? globalThis.fetch + + return (http: ServerConnection.HttpBase) => checkServerHealth(http, fetcher) +} -- cgit v1.2.3