Repository navigation
Add script to detect react components the compiler cannot optimize - #10090
MichaelBuessemeyer wants to merge 2 commits into
Conversation
…can't be optimized
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughAdds a ChangesReact Compiler Report
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change adds a development-only script for reporting which React components the compiler cannot optimize. It does not affect production behavior, and no merge-blocking risk was found. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The command analyzes files and prints reports without changing application state. No introduced security vulnerability was demonstrated. Caller-supplied patterns can select files beyond the frontend directory, so its exposure depends on who invokes it and where its output is published. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks the compiler’s trail, Comment |
MichaelBuessemeyer
left a comment
There was a problem hiding this comment.
example script output:
frontend/javascripts/viewer/view/right_border_tabs/generate_bounding_boxes_modal.tsx
64 GenerateBoundingBoxesModalInner
145:7 (BuildHIR::lowerStatement) Handle TryStatement with a finalizer ('finally') clause
frontend/javascripts/viewer/view/right_border_tabs/scrollable_virtualized_tree.tsx
12 ScrollableVirtualizedTree
19:5 Expected the first argument to be an inline function expression
Expected the first argument to be an inline function expression
frontend/javascripts/viewer/view/right_border_tabs/segments_tab/inline_editable_name.tsx
34 InlineEditableName
55:3 Cannot access refs during render
React refs are values that are not needed for rendering. Refs should only be accessed outside of render, such as in event handlers or effects. Accessing a ref value (the `current` property) during ren…
57:3 Cannot access refs during render
React refs are values that are not needed for rendering. Refs should only be accessed outside of render, such as in event handlers or effects. Accessing a ref value (the `current` property) during ren…
frontend/javascripts/viewer/view/right_border_tabs/sidebar_context_menu.tsx
8 ContextMenuInner
17:27 Cannot access refs during render
React refs are values that are not needed for rendering. Refs should only be accessed outside of render, such as in event handlers or effects. Accessing a ref value (the `current` property) during ren…
frontend/javascripts/viewer/view/right_border_tabs/skeleton_tab/hooks/use_skeleton_export.ts
24 useSkeletonExport
40:7 (BuildHIR::lowerStatement) Handle TryStatement with a finalizer ('finally') clause
73:5 (BuildHIR::lowerStatement) Handle TryStatement with a finalizer ('finally') clause
77:15 (BuildHIR::lowerExpression) Handle Import expressions
frontend/javascripts/viewer/view/right_border_tabs/skeleton_tab/skeleton_tab_view.tsx
30 ExportProgressModal
35:5 Cannot access refs during render
React refs are values that are not needed for rendering. Refs should only be accessed outside of render, such as in event handlers or effects. Accessing a ref value (the `current` property) during ren…
41:14 Cannot access refs during render
React refs are values that are not needed for rendering. Refs should only be accessed outside of render, such as in event handlers or effects. Accessing a ref value (the `current` property) during ren…
frontend/javascripts/viewer/view/statusbar/use_overflow_measurement.ts
51 useOverflowMeasurement
61:3 Cannot access refs during render
React refs are values that are not needed for rendering. Refs should only be accessed outside of render, such as in event handlers or effects. Accessing a ref value (the `current` property) during ren…
frontend/javascripts/viewer/view/version_list.tsx
244 InnerVersionList
355:5 (BuildHIR::lowerStatement) Handle TryStatement without a catch clause
frontend/javascripts/viewer/view/voxel_pipette_tooltip.tsx
57 VoxelValueTooltip
162:5 Cannot access refs during render
React refs are values that are not needed for rendering. Refs should only be accessed outside of render, such as in event handlers or effects. Accessing a ref value (the `current` property) during ren…
React Compiler: 598 functions compiled, 92 not compiled (786 files analyzed).
Most common reasons:
25x (BuildHIR::lowerStatement) Handle TryStatement with a finalizer ('finally') clause
20x Cannot access refs during render
10x Cannot access variable before it is declared
9x (BuildHIR::lowerStatement) Handle TryStatement without a catch clause
7x (BuildHIR::lowerExpression) Handle BigIntLiteral expressions
6x (BuildHIR::lowerStatement) Support ThrowStatement inside of try/catch
5x Existing memoization could not be preserved
4x Support value blocks (conditional, logical, optional chaining, etc) within a try/catch statement
3x This value cannot be modified
2x (BuildHIR::lowerExpression) Handle UpdateExpression to variables captured within lambdas.
| const CODE_FILTER = | ||
| /forwardRef|memo|(?:const|let|var|function)\s+(?:[A-Z]|use[A-Z0-9])|(?:[A-Z]|use[A-Z0-9])[^\s:=(){}[\],;]*\s*(?:\(|[:=]\s*(?:function|\())/; |
There was a problem hiding this comment.
Maybe we can also leave this optimization out to ensure catching every file? 🤔
There was a problem hiding this comment.
do you know the perf difference? as the script isnt run in the CI anyway, I don't care much about it right now 😅
There was a problem hiding this comment.
Na not really. The AI says:
The filter skips only 12 of 786 files (0.4% of the code).
The AIs measurements claimed that about 2% speedup is reached -> not worth it. I removed it
| const CODE_FILTER = | ||
| /forwardRef|memo|(?:const|let|var|function)\s+(?:[A-Z]|use[A-Z0-9])|(?:[A-Z]|use[A-Z0-9])[^\s:=(){}[\],;]*\s*(?:\(|[:=]\s*(?:function|\())/; |
There was a problem hiding this comment.
do you know the perf difference? as the script isnt run in the CI anyway, I don't care much about it right now 😅
Summary
Does what the PR description says.
Maybe I'd add some or all component fixes. Maybe as a stacked pr.
Steps to test:
Issues:
(Please delete unneeded items, merge only when none are left open)
Added changelog entry (create a-> not needed imo as not user facing.$PR_NUMBER.mdfile inunreleased_changesor use./tools/create-changelog-entry.py)