refactor(core): make watcher subscription effectful
This commit is contained in:
parent
fc11ed3838
commit
bd906d468d
5 changed files with 49 additions and 34 deletions
|
|
@ -393,7 +393,8 @@ export const layer = (options?: Options) => Layer.effect(
|
|||
const key = JSON.stringify(target)
|
||||
if (watched.has(key)) continue
|
||||
watched.add(key)
|
||||
yield* watcher.subscribe(target).pipe(
|
||||
const stream = yield* watcher.subscribe(target)
|
||||
yield* stream.pipe(
|
||||
Stream.runForEach((update) => PubSub.publish(updates, update)),
|
||||
Effect.forkScoped({ startImmediately: true }),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue