0.1.13 #18

Merged
Thilawyn merged 359 commits from next into master 2025-06-18 00:12:19 +02:00
3 changed files with 8 additions and 8 deletions
Showing only changes of commit 94a0864132 - Show all commits

View File

@@ -1,5 +1,5 @@
import type * as AsyncData from "@typed/async-data"
import { type Cause, type Context, Effect, type Fiber, Layer, type Stream, type SubscriptionRef } from "effect"
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 * as QueryRunner from "./QueryRunner.js"
@@ -13,7 +13,7 @@ export interface UseQueryProps<K extends readonly unknown[], A, E, R> {
}
export interface UseQueryResult<K extends readonly unknown[], A, E> {
readonly keyStream: Stream.Stream<K>
readonly latestKey: SubscriptionRef.SubscriptionRef<Option.Option<K>>
readonly state: SubscriptionRef.SubscriptionRef<AsyncData.AsyncData<A, E>>
readonly refresh: Effect.Effect<Fiber.RuntimeFiber<void, Cause.NoSuchElementException>>
@@ -41,12 +41,12 @@ export const QueryExtension = ReffuseExtension.make(() => ({
[props.refreshOnWindowFocus, runner])
return React.useMemo(() => ({
keyStream: props.key,
latestKey: runner.latestKeyRef,
state: runner.stateRef,
refresh: runner.forkRefresh,
layer: tag => Layer.succeed(tag, {
keyStream: props.key,
latestKey: runner.latestKeyRef,
state: runner.stateRef,
refresh: runner.forkRefresh,
}),

View File

@@ -4,9 +4,9 @@ import { type Cause, Effect, Fiber, identity, Option, Ref, type Scope, Stream, S
export interface QueryRunner<K extends readonly unknown[], A, E, R> {
readonly key: Stream.Stream<K>
readonly query: (key: K) => Effect.Effect<A, E, R>
readonly latestKeyRef: SubscriptionRef.SubscriptionRef<Option.Option<K>>
readonly stateRef: SubscriptionRef.SubscriptionRef<AsyncData.AsyncData<A, E>>
readonly fiberRef: SubscriptionRef.SubscriptionRef<Option.Option<Fiber.RuntimeFiber<void, Cause.NoSuchElementException>>>
@@ -128,9 +128,9 @@ export const make = <K extends readonly unknown[], A, E, R>(
)
return {
key,
query,
latestKeyRef,
stateRef,
fiberRef,

View File

@@ -1,9 +1,9 @@
import type * as AsyncData from "@typed/async-data"
import { type Cause, Effect, type Fiber, type Stream, type SubscriptionRef } from "effect"
import { type Cause, Effect, type Fiber, type Option, type SubscriptionRef } from "effect"
export interface QueryService<K extends readonly unknown[], A, E> {
readonly keyStream: Stream.Stream<K>
readonly latestKey: SubscriptionRef.SubscriptionRef<Option.Option<K>>
readonly state: SubscriptionRef.SubscriptionRef<AsyncData.AsyncData<A, E>>
readonly refresh: Effect.Effect<Fiber.RuntimeFiber<void, Cause.NoSuchElementException>>
}