Buckets:
| import { createSimpleContext } from "@opencode-ai/ui/context" | |
| import { queryOptions, useQuery, useQueryClient } from "@tanstack/solid-query" | |
| import { createEffect, onCleanup } from "solid-js" | |
| import type { WslServersState } from "./types" | |
| import { usePlatform } from "../context/platform" | |
| const wslServersQueryKey = ["platform", "wslServers"] as const | |
| export const { use: useWslServers, provider: WslServersProvider } = createSimpleContext({ | |
| name: "WslServers", | |
| init: () => { | |
| const platform = usePlatform() | |
| const queryClient = useQueryClient() | |
| const query = useQuery(() => { | |
| const api = platform.wslServers | |
| return queryOptions<WslServersState>({ | |
| queryKey: wslServersQueryKey, | |
| queryFn: () => api!.getState(), | |
| enabled: !!api, | |
| staleTime: Number.POSITIVE_INFINITY, | |
| gcTime: Number.POSITIVE_INFINITY, | |
| }) | |
| }) | |
| createEffect(() => { | |
| const api = platform.wslServers | |
| if (!api) return | |
| const off = api.subscribe((event) => { | |
| queryClient.setQueryData(wslServersQueryKey, event.state) | |
| }) | |
| onCleanup(off) | |
| }) | |
| return query as typeof query & { readonly data: WslServersState | undefined } | |
| }, | |
| }) | |
Xet Storage Details
- Size:
- 1.21 kB
- Xet hash:
- 1bfc526d8a61845564635c60bb05c7f8f28357008c57c2b4bf338af0daca006a
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.