-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(explorer): add UI for creating PRs #104500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #104500 +/- ##
========================================
Coverage 80.50% 80.51%
========================================
Files 9352 9352
Lines 400285 400268 -17
Branches 25704 25702 -2
========================================
- Hits 322264 322258 -6
+ Misses 77553 77542 -11
Partials 468 468 |
| blocks, | ||
| repoPRStates, | ||
| onCreatePR, | ||
| }); | ||
|
|
||
| if (!hasCodeChanges) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <Button ref={ref as any} size="xs" onClick={onToggleMenu}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: The PRWidget component fails to forward ref to its internal Button because it's not wrapped with React.forwardRef().
Severity: CRITICAL | Confidence: High
🔍 Detailed Analysis
The PRWidget component receives a ref prop but is not wrapped with React.forwardRef(). This prevents the ref from being properly forwarded to the underlying Button element. Consequently, prWidgetButtonRef.current will be null, causing click-outside detection to fail in explorerPanel.tsx. Additionally, menu positioning will fail in explorerMenu.tsx as getBoundingClientRect() will be called on a null reference, leading to a runtime error.
💡 Suggested Fix
Wrap the PRWidget component export with React.forwardRef() to ensure the ref is properly forwarded to the internal Button element.
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: static/app/views/seerExplorer/prWidget.tsx#L285-L298
Potential issue: The `PRWidget` component receives a `ref` prop but is not wrapped with
`React.forwardRef()`. This prevents the ref from being properly forwarded to the
underlying `Button` element. Consequently, `prWidgetButtonRef.current` will be `null`,
causing click-outside detection to fail in `explorerPanel.tsx`. Additionally, menu
positioning will fail in `explorerMenu.tsx` as `getBoundingClientRect()` will be called
on a null reference, leading to a runtime error.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 6207562
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
react 19 doesn't need forwardRef
| currentState.pr_creation_status === 'error' && | ||
| currentState.pr_creation_error | ||
| ) { | ||
| addErrorMessage(currentState.pr_creation_error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| currentState.pr_creation_status === 'error' && | |
| currentState.pr_creation_error | |
| ) { | |
| addErrorMessage(currentState.pr_creation_error); | |
| currentState.pr_creation_status === 'error' | |
| ) { | |
| addErrorMessage(currentState.pr_creation_error ?? ''); |
do we need to check the error msg exists?
| } | ||
| }, [isVisible, menuMode, menuAnchorRef, inputAnchorRef, prWidgetAnchorRef]); | ||
|
|
||
| const menu = isVisible ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was there a problem with the Activity component?
| }, [menuMode, close, refetchSessions]); | ||
|
|
||
| // Handler for opening PR widget from button | ||
| const openPRWidget = useCallback(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const openPRWidget = useCallback(() => { | |
| const togglePRWidget = useCallback(() => { |
same for openSessionHistory
|
wont be able to test this til the backend prs are merged right? |
oh no, those ones were just for updating the client right (pr backend already works) |
adds UI for creating pull requests

requires https://github.com/getsentry/seer/pull/4187
part of AIML-1695