diff --git a/packages/effect-fc/src/Query.ts b/packages/effect-fc/src/Query.ts index 9c306b7..875cb84 100644 --- a/packages/effect-fc/src/Query.ts +++ b/packages/effect-fc/src/Query.ts @@ -11,7 +11,7 @@ extends Pipeable.Pipeable { readonly [QueryTypeId]: QueryTypeId readonly context: Context.Context - readonly key: Stream.Stream + readonly key: Stream.Stream readonly f: (key: K) => Effect.Effect readonly initialProgress: P diff --git a/packages/example/src/routes/query.tsx b/packages/example/src/routes/query.tsx index 1db5ef5..a6e2f4d 100644 --- a/packages/example/src/routes/query.tsx +++ b/packages/example/src/routes/query.tsx @@ -18,9 +18,10 @@ const ResultView = Component.make("ResultView")(function*() { const [idRef, query, mutation] = yield* Component.useOnMount(() => Effect.gen(function*() { const idRef = yield* SubscriptionRef.make(1) + const key = Stream.map(idRef.changes, id => [id] as const) const query = yield* Query.service({ - key: Stream.map(idRef.changes, id => [id] as const), + key, f: ([id]) => HttpClient.HttpClient.pipe( Effect.tap(Effect.sleep("500 millis")), Effect.andThen(client => client.get(`https://jsonplaceholder.typicode.com/posts/${ id }`)),