fix: surface reconcile subscription failures via console.error#45
Merged
Conversation
ClientControlCtx and both HydrationControlCtx factories implemented subscribe(readable, handler) by forking the stream reader into the parent scope via Effect.forkIn. That's the right lifecycle model but forkIn swallows fiber failures — if handler ever failed (a route render threw, a data provider died mid-navigation, a slot insertion errored) the fiber died silently and the UI froze with no console output. Extracted a shared subscribeReconcile helper that logs each failing handler run with a full Effect Cause.pretty (fiber trace + underlying errors) and catches the failure at the per-value boundary so a single bad update doesn't kill the subscription — subsequent state changes still fire the handler. Navigation to a broken route and back now recovers. Reconcile subscription is what drives Outlet's re-render on nav.pathname changes, so this specifically fixes silent navigation failures reported downstream. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Deploying effex with
|
| Latest commit: |
caff662
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://838e2d3a.effex.pages.dev |
| Branch Preview URL: | https://fix-outlet-surface-errors.effex.pages.dev |
Deploying effex-api with
|
| Latest commit: |
caff662
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://af610740.effex-api.pages.dev |
| Branch Preview URL: | https://fix-outlet-surface-errors.effex-api.pages.dev |
Effect's Console service is idiomatic in an Effect-native codebase — it runs inside the fiber, returns Effect<void> (no need to wrap in Effect.sync), and can be swapped via Layer for tests. Default sink delegates to the real console, so existing spy-on-console tests keep working. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Answer to "does Outlet swallow errors?" — yes, and this PR stops it.
Where the swallow was
All three `ControlCtx` implementations had:
```ts
subscribe: (readable, handler) =>
Effect.gen(function* () {
const scope = yield* Effect.scope;
yield* readable.changes.pipe(
Stream.runForEach(handler),
Effect.forkIn(scope),
);
}),
```
Right lifecycle model — the stream reader lives with the parent scope and cleans up on unmount. Wrong error handling: `Effect.forkIn` swallows fiber failures. If `handler` ever failed (a route render threw, a data provider died mid-navigation, a slot insertion errored), the fiber died and nothing surfaced. UI froze; console stayed clean.
Reconcile's subscription is what drives `Outlet`'s re-render on `nav.pathname` changes, so this specifically explains the "silent navigation failure" pattern.
Fix
Extracted a shared `subscribeReconcile` helper (`packages/dom/src/Control/subscribeReconcile.ts`). All three `ControlCtx` `subscribe` fields now point at it. It:
Test plan
Related
Third in a small series of "make silent failures loud" changes:
Together these cover the three "your UI is broken but the console is empty" traps in the framework.
🤖 Generated with Claude Code