This commit is contained in:
@@ -10,11 +10,13 @@ export class Uuid4Query extends QueryService.Tag("Uuid4Query")<Uuid4Query,
|
||||
HttpClientError.HttpClientError | ParseResult.ParseError
|
||||
>() {}
|
||||
|
||||
export const Uuid4QueryLive = QueryService.layer(Uuid4Query, Console.log("Querying...").pipe(
|
||||
Effect.andThen(Effect.sleep("500 millis")),
|
||||
Effect.andThen(HttpClient.get("https://www.uuidtools.com/api/generate/v4")),
|
||||
HttpClient.withTracerPropagation(false),
|
||||
Effect.flatMap(res => res.json),
|
||||
Effect.flatMap(Schema.decodeUnknown(Result)),
|
||||
Effect.scoped,
|
||||
))
|
||||
export const Uuid4QueryLive = QueryService.layer(Uuid4Query, {
|
||||
query: Console.log("Querying...").pipe(
|
||||
Effect.andThen(Effect.sleep("500 millis")),
|
||||
Effect.andThen(HttpClient.get("https://www.uuidtools.com/api/generate/v4")),
|
||||
HttpClient.withTracerPropagation(false),
|
||||
Effect.flatMap(res => res.json),
|
||||
Effect.flatMap(Schema.decodeUnknown(Result)),
|
||||
Effect.scoped,
|
||||
)
|
||||
})
|
||||
|
||||
@@ -17,7 +17,7 @@ function RouteComponent() {
|
||||
const runSync = R.useRunSync()
|
||||
|
||||
const { state, refresh } = R.useQuery({
|
||||
effect: () => Console.log("Querying...").pipe(
|
||||
query: () => Console.log("Querying...").pipe(
|
||||
Effect.andThen(Effect.sleep("500 millis")),
|
||||
Effect.andThen(HttpClient.get("https://www.uuidtools.com/api/generate/v4")),
|
||||
HttpClient.withTracerPropagation(false),
|
||||
@@ -25,7 +25,7 @@ function RouteComponent() {
|
||||
Effect.flatMap(Schema.decodeUnknown(Result)),
|
||||
Effect.scoped,
|
||||
),
|
||||
deps: [],
|
||||
key: [],
|
||||
})
|
||||
|
||||
const [queryState] = R.useRefState(state)
|
||||
|
||||
Reference in New Issue
Block a user