fix(bindx): support direct field access on PlaceholderHandle proxy#7
Merged
fix(bindx): support direct field access on PlaceholderHandle proxy#7
Conversation
PlaceholderHandle.wrapProxy used createAliasProxy which only strips the $ prefix but does not delegate unknown properties to target.fields. This caused entity.fieldName to return undefined for placeholder entities (e.g. when creating new entities via HasOne). Switch to createHandleProxy so that direct field access (entity.name) resolves through the fields proxy, matching EntityHandle behavior. Also transition disconnected relations to 'creating' state when SET_PLACEHOLDER_DATA is dispatched, ensuring placeholder data is properly tracked for new entities.
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
createAliasProxywhich only strips the$prefix but does not delegate unknown properties totarget.fields. This causedentity.fieldNameto returnundefinedfor placeholder entities (e.g. when creating new entities viaHasOne). Switched tocreateHandleProxyto matchEntityHandlebehavior.creatingstate, ensuring placeholder data is properly tracked for new entities.Test plan
bun testpasses<Entity entity={schema.X} create>and accessing fields likeentity.nameworks without errors