Skip to content

Conversation

@roaga
Copy link
Member

@roaga roaga commented Dec 6, 2025

adds UI for creating pull requests
Screenshot 2025-12-06 at 11 35 46 AM

Screenshot 2025-12-06 at 11 38 24 AM

requires https://github.com/getsentry/seer/pull/4187

part of AIML-1695

@linear
Copy link

linear bot commented Dec 6, 2025

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Dec 6, 2025
@codecov
Copy link

codecov bot commented Dec 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

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           

@roaga roaga marked this pull request as ready for review December 8, 2025 15:51
@roaga roaga requested a review from a team as a code owner December 8, 2025 15:51
@roaga roaga requested a review from aliu39 December 8, 2025 15:51
Comment on lines +288 to +298
blocks,
repoPRStates,
onCreatePR,
});

if (!hasCodeChanges) {
return null;
}

return (
<Button ref={ref as any} size="xs" onClick={onToggleMenu}>
Copy link

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

Copy link
Member Author

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

Comment on lines 428 to 431
currentState.pr_creation_status === 'error' &&
currentState.pr_creation_error
) {
addErrorMessage(currentState.pr_creation_error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 ? (
Copy link
Member

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(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const openPRWidget = useCallback(() => {
const togglePRWidget = useCallback(() => {

same for openSessionHistory

@aliu39
Copy link
Member

aliu39 commented Dec 8, 2025

wont be able to test this til the backend prs are merged right?

@aliu39
Copy link
Member

aliu39 commented Dec 8, 2025

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)

@roaga roaga merged commit df95336 into master Dec 8, 2025
49 checks passed
@roaga roaga deleted the explorer/pr-creation-ui branch December 8, 2025 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants