fix(server): let forked reactors subscribe before dispatch

This commit is contained in:
t3-code[bot] committed 2026-08-07 20:57:49 +00:00
1 parent dbd8189dca
commit f483b694c0
2 files changed
+15

No files matched your search

+12
View File
@@ -21,3 +21,15 @@ it.effect("proves a root is parked before returning and releases it with one gat
}),
),
);
it.effect("lets an unparked child start before returning", () =>
Effect.scoped(
Effect.gen(function* () {
const started = yield* Deferred.make<void>();
yield* forkParked(Deferred.succeed(started, undefined));
expect(yield* Deferred.isDone(started)).toBe(true);
}),
),
);
+3
View File
@@ -16,6 +16,9 @@ export const forkParked = <A, E, R>(
const activation = yield* ServerActivation;
if (activation === undefined) {
yield* Effect.forkScoped(effect);
// Let the child reach its first suspension point before startup continues.
// Hot-stream consumers use this turn to establish their subscription.
yield* Effect.yieldNow;
return;
}
const parked = yield* Deferred.make<void>();