Skip to content

feat(replays): Display component name in selector when available - #68840

Merged
c298lee merged 10 commits into
masterfrom
cl/component-display-name
Apr 15, 2024
Merged

c298lee merged 10 commits into
masterfrom
cl/component-display-name

Conversation

@c298lee

@c298lee c298lee commented Apr 12, 2024 •

Copy link
Copy Markdown
Contributor

Adds a display selector so the selector is more readable if there's a component name.
image

Related to #64673

@c298lee
c298lee requested a review from a team April 12, 2024 21:43
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 12, 2024
@c298lee
c298lee marked this pull request as draft April 12, 2024 21:43
@codecov

codecov Bot commented Apr 12, 2024 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 2.67kB ⬆️

Bundle name Size Change
sentry-webpack-bundle-array-push 26.3MB 2.67kB ⬆️

@c298lee
c298lee marked this pull request as ready for review April 12, 2024 21:51
}}
>
<TextOverflow>{value}</TextOverflow>
<TextOverflow>{display}</TextOverflow>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i'm wondering if it's confusing that this display doesn't match the value above in the code snippet (the one that shows up on hover). i know the full selector is needed for search to work though, and logically the code snippet is supposed to be copy-able for search. but it might be weird that the display & the hover look different. what do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yea I do think it's weird that display and value don't match, but I'm not sure what a good solution for this is. We want to surface the react component name when possible in place of the classes, but our search and aggregation still includes the classes so I'm not sure what the best solution is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i'm thinking maybe we should have the hover tooltip match what's displayed in the widget. i think the original intent of the tooltip was show the full selector when it's overflowed, so let's make them match

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok! we don't need display selector anymore then!!

fullComponentName;
const selector =
tag + id + classes + role + ariaLabel + testId + alt + title + componentName;
const displaySelector = componentName

@michellewzhang michellewzhang Apr 15, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is there a reason we keep the id here for displaySelector if there's a component name? (might've missed something while i was out)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the id can still provide some useful context! We want to replace the tag and classes tho since we don't think those are as useful

@michellewzhang michellewzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good! thanks for making all the changes!

@c298lee
c298lee merged commit 530d898 into master Apr 15, 2024
@c298lee
c298lee deleted the cl/component-display-name branch April 15, 2024 22:26
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 2024

This branch was successfully deployed

1 active deployment
Preview — fa3d48c4 Deployed Apr 15, 2024 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants