test: reproduce createComponent children selection gap#26
Merged
Conversation
When a createComponent wraps other bindx components via `children`, analyzeJsx does not descend into them and createGetSelection ignores the `collectNested` callback, so the child's own selection is missing from the fetch plan. Test currently fails — documents the bug for a follow-up fix.
…lected analyzeJsx stopped at any component exposing getSelection and never recursed into its children. createGetSelection in componentFactory discarded collectNested and never invoked it. Children that were themselves createComponent instances had their selection silently dropped, surfacing at runtime as UnfetchedFieldError. Introduce .slots(names) on the component builder. Listed props are walked via collectNested after the wrapper's own selection is computed, so each slot's nested bindx components contribute to the fetch plan. Default is ['children']; pass [] to opt out, or a custom list to analyze other ReactNode-shaped props (header, footer, etc.). Co-Authored-By: Claude Opus 4.7 (1M context) <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
createComponentwraps other bindx components viachildren, the child's own selection is never merged into the fetch plan.analyzer.tsstops at any component exposinggetSelection(no recursion intoprops.children), andcreateGetSelectionincomponentFactory.tsreceivescollectNestedas_collectNestedand never invokes it. Every other selection-providing component (<If>,<Show>,<HasOne>,<HasMany>,<Switch>,<Attribute>) does call it.UnfetchedFieldErrorthe moment the child accessor reads a field only its owncreateComponentselection declared.Test plan
bun test tests/selectionCollection.test.tsx— expect the new casecreateComponent children via \children` prop contribute to selectionto fail onexpect(selection.fields.has('label')).toBe(true)`; all 12 existing cases still pass.createGetSelectioncallcollectNested(props.children), or haveanalyzeJsxrecurse intochildrenaftergetSelectionwhen a component renders its children verbatim), the new test flips to green with no other regressions.