Skip to content

Conversation

@leedongwei
Copy link
Contributor

Screenshot 2025-06-23 at 10 55 21 AM

Screenshot 2025-06-23 at 10 55 25 AM

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 23, 2025
@leedongwei leedongwei requested a review from a team June 23, 2025 17:56
@iamrajjoshi iamrajjoshi requested a review from ameliahsu June 23, 2025 20:28
Copy link
Member

@malwilley malwilley left a comment

Choose a reason for hiding this comment

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

Also - just a design nit, but usually we hide row actions behind an ellipsis menu to avoid a bunch of angry red icons on the page. But since it's the only action it's probably okay?

const primary = user.email;
const emails = user.emails ? user.emails : [{email: primary}];

const handleRemoveEmail = async (email: string) => {
Copy link
Member

Choose a reason for hiding this comment

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

Can you use useMutation() instead? It uses react query and is the ✨ new way ✨

https://develop.sentry.dev/frontend/network-requests/#mutations-postputdelete-requests

{data.email !== primary && (
<Confirm
message={`Are you sure you want to remove the email ${data.email}?`}
onConfirm={() => handleRemoveEmail(data.email)}
Copy link
Member

@malwilley malwilley Jun 23, 2025

Choose a reason for hiding this comment

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

If you use the useMutation hook, you can use mutateAsync here to keep the async functionality

name: 'Addresses',
content: ({Panel}) => <UserEmails Panel={Panel} user={user} />,
content: ({Panel}) => (
<UserEmails Panel={Panel} user={user} onUserUpdate={refetchUser} />
Copy link
Member

Choose a reason for hiding this comment

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

You can also directly modify the cache after this succeeds if you want the list to immediately update instead of having a delay: https://develop.sentry.dev/frontend/network-requests/#updating-your-query-data

Copy link
Contributor

@ameliahsu ameliahsu left a comment

Choose a reason for hiding this comment

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

mainly nits about testing


expect(screen.getByText('primary@example.com')).toBeInTheDocument();
expect(screen.getByText('secondary@example.com')).toBeInTheDocument();
expect(screen.getByText('— primary')).toBeInTheDocument();
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use textWithMarkupMatcher to match text within multiple nodes, to make sure that the correct email is being labeled as primary

render(<UserEmails Panel={mockPanel} user={mockUser} />);

// Should show remove button for secondary email
expect(screen.getByTestId('remove-email-button')).toBeInTheDocument();
Copy link
Contributor

Choose a reason for hiding this comment

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

should use screen.getByRole() instead of using test id

>
<Button
data-test-id="remove-email-button"
priority="danger"
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure if there's a design pattern for this but i would just make the priority="default" for the buttons in the table, this is a random example i found from settings/account/identities/

Screenshot 2025-06-23 at 2 11 18 PM
@getsantry
Copy link
Contributor

getsantry bot commented Jul 15, 2025

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added Stale and removed Stale labels Jul 15, 2025
@leedongwei leedongwei added the WIP label Jul 18, 2025
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 WIP

4 participants