Refactor
All checks were successful
Lint / lint (push) Successful in 12s

This commit is contained in:
Julien Valverdé
2026-02-27 13:21:56 +01:00
parent 8e81ec85de
commit 21028fd75b
7 changed files with 34 additions and 34 deletions

View File

@@ -13,15 +13,15 @@ const Post = Schema.Struct({
body: Schema.String,
})
const ResultView = Component.makeUntraced("Result")(function*() {
const ResultView = Component.make("ResultView")(function*() {
const runPromise = yield* Component.useRunPromise()
const [idRef, query, mutation] = yield* Component.useOnMount(() => Effect.gen(function*() {
const idRef = yield* SubscriptionRef.make(1)
const query = yield* Query.service({
key: Stream.zipLatest(Stream.make("posts" as const), idRef.changes),
f: ([, id]) => HttpClient.HttpClient.pipe(
key: Stream.map(idRef.changes, id => [id] as const),
f: ([id]) => HttpClient.HttpClient.pipe(
Effect.tap(Effect.sleep("500 millis")),
Effect.andThen(client => client.get(`https://jsonplaceholder.typicode.com/posts/${ id }`)),
Effect.andThen(response => response.json),