Skip to content
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

fix(perf): Perf Landing v3 UI Tweaks #29812

Merged
merged 6 commits into from
Nov 5, 2021
Merged

Conversation

k-fish
Copy link
Member

@k-fish k-fish commented Nov 5, 2021

Summary

This include quite a few small fixes to the functionality of the landing page widgets, split up by commit

  • Removed zoom in the histogram widgets for now since we don't have reset / de-zoom
  • Added a few more widgets to frontend pageload / other
  • Fixed reloading problem for singleField (miniChart) widgets by fixing issues with eventView memoization and providing too many props to eventsRequest
  • Fixed problem with most issues where it would temporarily pick an undefined issue when changing widget types.

This disables the zoom in the histogram widget for now until we introduce a reset or some way to zoom out.
Frontend other can have both http requests for retrieving data as well
as resource ops due to chunk loading techniques (webpack)
…the data is null for the selectedListIndex picking out of the array.
@k-fish k-fish requested a review from a team as a code owner November 5, 2021 14:55
@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2021

size-limit report

Path Base Size (5d6d801) Current Size Change
src/sentry/static/sentry/dist/entrypoints/app.js 52.77 KB 52.76 KB -0.01% 🔽
src/sentry/static/sentry/dist/entrypoints/sentry.css 70.89 KB 70.89 KB 0%

Copy link
Member

@Zylphrex Zylphrex left a comment

Choose a reason for hiding this comment

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

Overall looks fine, though I'm not sure the hook dependencies are correct or not.

@@ -80,6 +80,7 @@ export function HistogramWidget(props: Props) {
field={props.fields[0]}
chartData={provided.widgetData.chart?.data?.[props.fields[0]]}
disableXAxis
disableZoom
Copy link
Member

Choose a reason for hiding this comment

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

We've never had an un-zoom feature, is there a reason why it's a necessity now?

Copy link
Member Author

Choose a reason for hiding this comment

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

You can zoom in a bunch of the widgets but there is no way to reset and unzoom, we're also currently not making 2nd requests to get the zoomed in data, I'd rather just exclude the ability for now.

},
};
}, [props.eventView.query, props.fields[0], props.organization.slug]);
const chart = useMemo<QueryDefinition<DataType, WidgetDataResult>>(
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I understand why the useMemo here is needed. If you wrap the memorized result inside of an object like you have below, it will always trigger a re-render of the child component since the reference to Queries will be different even if chart has been memorized right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Re-rendering the same component is fine now, building a new component inside an object each render isn't. Since it wasn't part of the jsx in the return iirc it was being rebuilt each time.

@@ -168,7 +176,7 @@ export function LineChartListWidget(props: Props) {
},
transform: transformEventsRequestToArea,
};
}, [props.eventView.query, field, props.organization.slug, selectedListIndex]);
}, [props.eventView, field, props.organization.slug, selectedListIndex]);
Copy link
Member

Choose a reason for hiding this comment

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

Can't say with confidence that I have a strong grasp on what this will do but won't this trigger a re-render on every location change because eventView is re-derived each time, resulting in a new reference?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah it schedules a rerender, but eventView is no longer being passed to the query component, so the component itself never refires. Re-renders are fine, but re-firing the api request is not. The eventView has more than just the query to look for (in this case statsPeriod was changing), I'd rather not figure out primitives for every facet of eventView that could change and just let the existing component refetch mechanism deal with it.

@k-fish k-fish merged commit 1418a7a into master Nov 5, 2021
@k-fish k-fish deleted the fix/perf-landing-ui-tweaks branch November 5, 2021 16:59
@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants