QueryClient
All checks were successful
Lint / lint (push) Successful in 13s

This commit is contained in:
Julien Valverdé
2025-03-14 22:00:53 +01:00
parent abc47c4647
commit 2e8dfbc988
5 changed files with 41 additions and 28 deletions

View File

@@ -2,7 +2,7 @@ import type * as AsyncData from "@typed/async-data"
import { type Cause, type Context, Effect, type Fiber, Layer, type Option, type Stream, type SubscriptionRef } from "effect"
import * as React from "react"
import { ReffuseExtension, type ReffuseHelpers } from "reffuse"
import type * as QueryClient from "./QueryClient.js"
import * as QueryClient from "./QueryClient.js"
import * as QueryRunner from "./QueryRunner.js"
import type * as QueryService from "./QueryService.js"
@@ -26,10 +26,11 @@ export interface UseQueryResult<K extends readonly unknown[], A, E> {
export const QueryExtension = ReffuseExtension.make(() => ({
useQuery<EH, K extends readonly unknown[], A, E, HandledE, R>(
this: ReffuseHelpers.ReffuseHelpers<R | QueryClient.QueryClient<EH, HandledE>>,
this: ReffuseHelpers.ReffuseHelpers<R | QueryClient.QueryClient<EH, HandledE> | EH>,
props: UseQueryProps<K, A, E, R>,
): UseQueryResult<K, A, Exclude<E, HandledE>> {
const runner = this.useMemo(() => QueryRunner.make({
QueryClient: QueryClient.makeTag<EH, HandledE>(),
key: props.key,
query: props.query,
}), [props.key])