fix(flow): component ref → React.forwardRef 래핑#773
Merged
Conversation
Flow의 `component View(ref?, ...props)` 문법에서 ref를 props의 일부로
취급하여 React가 View(props, ref)로 호출할 때 ref가 undefined가 되는 버그.
hermes-parser와 동일하게 변환:
- ref 있으면: function Name_withRef({...props}, ref) + const Name = React.forwardRef(Name_withRef)
- ref 없으면: function Name({...props}) (기존 동작)
- rest만 있으면: function Name(props) (destructuring 없이 단일 param)
- 파서: ref 감지 시 flow_component_wrapper AST 노드 생성
- transformer: pending_nodes 패턴으로 1→2 statement 확장
- 테스트 3개 추가 (forwardRef, plain function, rest-only)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Smoke Test Results (CI)Smoke Test Results
Size Comparison (ZTS vs esbuild)
Average ratio: 0.94x | Smaller: 122 | Similar(±10%): 1 | Larger: 8
|
Benchmark Results (CI)macos-latesttranspile — small (100 lines)
transpile — medium (1K lines)
transpile — large (5K lines)
bundle — small (10 modules)
bundle — medium (50 modules)
bundle — large (200 modules)
ubuntu-latesttranspile — small (100 lines)
transpile — medium (1K lines)
transpile — large (5K lines)
bundle — small (10 modules)
bundle — medium (50 modules)
bundle — large (200 modules)
windows-latesttranspile — small (100 lines)
transpile — medium (1K lines)
transpile — large (5K lines)
bundle — small (10 modules)
bundle — medium (50 modules)
bundle — large (200 modules)
|
This was referenced Apr 5, 2026
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
component View(ref?, ...props)문법에서 ref를 props 안에 넣어서 React가 ref를 받지 못하는 버그 수정React.forwardRef+ 2번째 인자로 ref 분리변환 결과
Test plan
zig build test통과bun test tests/es5-rn.test.ts통과🤖 Generated with Claude Code