Fix PropertyAccessExpression in JSX tags (Context.Provider, React.Fragment)#13
Merged
evilbocchi merged 7 commits intomainfrom Feb 2, 2026
Merged
Fix PropertyAccessExpression in JSX tags (Context.Provider, React.Fragment)#13evilbocchi merged 7 commits intomainfrom
evilbocchi merged 7 commits intomainfrom
Conversation
…JSX tags Co-authored-by: evilbocchi <[email protected]>
Co-authored-by: evilbocchi <[email protected]>
Co-authored-by: evilbocchi <[email protected]>
Co-authored-by: evilbocchi <[email protected]>
Co-authored-by: evilbocchi <[email protected]>
Copilot
AI
changed the title
[WIP] Fix compilation error with context usage
Fix PropertyAccessExpression in JSX tags (Context.Provider, React.Fragment)
Feb 2, 2026
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the
Comment |
There was a problem hiding this comment.
Pull request overview
Fixes JSX tag-name handling so member-expression tags like Ctx.Provider / React.Fragment are preserved through transformation instead of being replaced with UnknownTag, preventing compile failures for Context Providers and other property-access JSX tags.
Changes:
- Added
jsxTagExpressionToStringhelper and updated tag-name extraction to supportPropertyAccessExpression,ThisExpression, and namespaced tags. - Updated code generation to pass the original
JsxTagNameExpressionintoReact.createElement(...)so member expressions remain intact. - Updated dependency tracking logic and added an integration test for
Context.Provider.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| transformer/src/utils.ts | Introduces shared JSX tag expression → string conversion utility. |
| transformer/src/index.ts | Uses the new utility for tag-name logging/debug paths (and avoids UnknownTag for member expressions). |
| transformer/src/analyzer.ts | Uses the new utility for tag-name extraction and adjusts dependency tracking for member expressions. |
| transformer/src/transformer.ts | Updates React.createElement generation to preserve member-expression tag references. |
| transformer/test/transformer.integration.test.ts | Adds integration coverage for Context.Provider not producing UnknownTag. |
| demo/src/context-test.tsx | Adds a demo repro/example for context Provider JSX. |
Co-authored-by: evilbocchi <[email protected]>
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.
JSX elements using PropertyAccessExpression tag names (
Ctx.Provider,React.Fragment) were transformed toUnknownTag, breaking compilation.Changes
jsxTagExpressionToStringutility: Handles Identifier, PropertyAccessExpression, ThisExpression, and JsxNamespacedNamegetJsxTagNameandgetTagNamenow use the utility instead of only handling IdentifiercreateTagReference: AcceptsJsxTagNameExpressionand preserves PropertyAccessExpression in outputgenerateFinePatchBlock,generateMemoizedBlock, andgenerateOptimizedElementextract and use tag expressionsCtx) from PropertyAccessExpression (Ctx.Provider)Context.Provider,React.Fragment, and Providers with dynamic props to prevent regressionsExample
Before:
Generated:
React.createElement(UnknownTag, ...)→ compilation errorAfter:
Generates:
React.createElement(layerContext.Provider, { value: depth + 1 })Testing
Context.Providerwith dynamic propsReact.FragmentOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.