Fix
Some checks failed
Lint / lint (push) Failing after 15s

This commit is contained in:
Julien Valverdé
2025-05-22 16:13:35 +02:00
parent 7e9a8a5fee
commit 28efea18f1

View File

@@ -1,3 +1,4 @@
import { BrowserStream } from "@effect/platform-browser"
import * as AsyncData from "@typed/async-data" import * as AsyncData from "@typed/async-data"
import { type Cause, type Context, Effect, Fiber, identity, Option, Queue, Ref, type Scope, Stream, SubscriptionRef } from "effect" import { type Cause, type Context, Effect, Fiber, identity, Option, Queue, Ref, type Scope, Stream, SubscriptionRef } from "effect"
import type * as QueryClient from "../QueryClient.js" import type * as QueryClient from "../QueryClient.js"
@@ -191,14 +192,12 @@ export const run = <K extends readonly unknown[], A, E, R>(
self: QueryRunner<K, A, E, R>, self: QueryRunner<K, A, E, R>,
options?: RunOptions, options?: RunOptions,
): Effect.Effect<void, Error | Cause.NoSuchElementException, Scope.Scope> => Effect.gen(function*() { ): Effect.Effect<void, Error | Cause.NoSuchElementException, Scope.Scope> => Effect.gen(function*() {
if (options?.refreshOnWindowFocus ?? false) if (options?.refreshOnWindowFocus ?? true)
yield* Effect.tryPromise({ yield* Stream.runForEach(
try: () => import("@effect/platform-browser/BrowserStream"), typeof window !== "undefined"
catch: () => new Error("Could not import @effect/platform-browser, make sure it is installed as it is a requirement for 'refreshOnWindowFocus'."), ? BrowserStream.fromEventListenerWindow("focus")
}).pipe( : Stream.empty,
Effect.flatMap(BrowserStream => Effect.forkScoped( () => self.forkRefresh,
Stream.runForEach(BrowserStream.fromEventListenerWindow("focus"), () => self.forkRefresh)
))
) )
yield* self.fetchOnKeyChange yield* self.fetchOnKeyChange