emitter: a child that fails to construct reports its own error, not the reconciler's - #407
Merged
Merged
Conversation
…s setups, so its own error is the one reported; its projected children still settle, and the reconciler refuses a list whose anchor was never placed
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.
A child component that fails to construct is caught, reported, and left as
null, but the setups for what it holds — a keyedfor, anif, a text binding — still ran. They ran against an anchor that was never placed, and__reconcile'sTypeError: undefined is not an object (evaluating 'anchor.parentNode')replaced the real error. The first error a newcomer meets, a misspelled name in a prop, came out as that.On main this throws the
TypeError; here it throwsReferenceError: nosuchname is not definedwith the stack at the prop.Cause and fix (
src/emitter.js,renderChildComponent). The setups that belong to a child's projected content now run insideif (child) { … }. A child component made inside that content keeps its own setup step, which already checks itself, so it never sticks mid-mount.__reconcilerefuses, by its own message, a list whose anchor was never placed; it does not fire here.The DOM had the same masking. It appears only when the name is a prop of a child component that holds the list: on a plain
divthe throw aborts the whole mount before any list code runs.Tests (all fail on main): in
test/ui/components.test.js, two broken children kept to their placeholders, each reported as its ownReferenceError, with later state changes and unmount clean, plus anonErrorboundary around a child that holds a keyedfor; inpackages/tui/test.rip, the example above makesrenderToStringthrow theReferenceErrorand print nothing.Corpus unchanged (0 written).
dist/regenerated.bun run test:all: 29 lanes, 12,668 tests.