refactor(core): make watcher subscription effectful

This commit is contained in:
Dax Raad 2026-07-29 09:49:38 -04:00
commit bd906d468d
5 changed files with 49 additions and 34 deletions

View file

@ -253,7 +253,8 @@ const layer = Layer.effect(
// inside), so don't watch what can't trigger anything.
if (yield* fs.isDir(operation.target)) continue
watched.add(operation.target)
yield* watcher.subscribe({ path: operation.target, type: "file" }).pipe(
const updates = yield* watcher.subscribe({ path: operation.target, type: "file" })
yield* updates.pipe(
Stream.runForEach(() => PubSub.publish(configuredChanges, undefined)),
Effect.catchCause((cause) =>
Effect.logError("configured plugin watch failed", { target: operation.target, cause }),