Skip to content

Conversation

@brainkim
Copy link
Member

@brainkim brainkim commented May 30, 2025

@brainkim
Copy link
Member Author

brainkim commented Jul 9, 2025

I’m stuck working on some tricky promise rejections.

From Copilot:

Analysis in Light of the Bug

The Bug: Async generator yields, then throws, but no unhandled rejection

Your reported bug suggests that after yielding, when an async generator throws, the error is not resulting in an unhandled promise rejection as expected.

How These Changes Address (or Don't Address) the Bug

The tests now explicitly check for unhandled rejections and will fail if the rejection does not occur.
However, there are no changes in the actual rendering/runtime code (e.g., in src/dom.ts or src/crank.ts) that change how thrown errors from async generators are surfaced. The bulk of the logic changes are in the test suite, not the core async generator or error propagation logic.
If the bug persists, it likely means the runtime (renderer) is catching errors internally and not letting them propagate as unhandled rejections. The new or unskipped tests will now fail, demonstrating the bug more clearly, but unless the renderer’s error handling code is changed, the underlying behavior will not change.

Recommendations

If your goal is to fix the bug, you will need to review the control flow in the renderer (likely in src/crank.ts or the main rendering loop in src/dom.ts), and ensure that errors thrown from async generators which are not caught by user code are not swallowed or turned into handled rejections.
The current PR is a great step for surfacing the bug and making the test suite fail where it should, but it does not, on its own, fix the underlying issue.
Summary

The changes in test/errors.tsx robustly surface and assert on error propagation and unhandled promise rejections from async generators.
The changes in src/dom.ts are mostly unrelated to error propagation, focusing on props/children handling.
The core bug (unhandled promise rejection not occurring) is not fixed by these changes—they only make the bug visible in tests.
To actually fix the bug, changes are needed in the renderer’s async generator error handling logic.

@brainkim brainkim force-pushed the 0.7 branch 2 times, most recently from 87f84f2 to 9dd074a Compare July 9, 2025 22:36
@brainkim brainkim requested a review from Copilot July 10, 2025 02:28

This comment was marked as outdated.

@brainkim brainkim requested a review from Copilot July 10, 2025 11:30

This comment was marked as outdated.

@brainkim brainkim changed the title 0.7 Version 0.7 Jul 10, 2025
@brainkim brainkim merged commit 6d59927 into main Aug 14, 2025
1 check passed
@brainkim brainkim deleted the 0.7 branch August 14, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants