-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
feat(insights): Introduce sort by selector for releases #82302
feat(insights): Introduce sort by selector for releases #82302
Conversation
@@ -0,0 +1,11 @@ | |||
export enum ReleasesSortOption { |
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.
this enum was just moved from
sentry/static/app/views/releases/list/releasesSortOptions.tsx
Lines 8 to 18 in 5078825
export enum ReleasesSortOption { | |
CRASH_FREE_USERS = 'crash_free_users', | |
CRASH_FREE_SESSIONS = 'crash_free_sessions', | |
USERS_24_HOURS = 'users_24h', | |
SESSIONS_24_HOURS = 'sessions_24h', | |
SESSIONS = 'sessions', | |
DATE = 'date', | |
BUILD = 'build', | |
SEMVER = 'semver', | |
ADOPTION = 'adoption', | |
} |
CRASH_FREE_USERS = 'crash_free_users', | ||
CRASH_FREE_SESSIONS = 'crash_free_sessions', | ||
USERS_24_HOURS = 'users_24h', | ||
SESSIONS_24_HOURS = 'sessions_24h', | ||
SESSIONS = 'sessions', | ||
DATE = 'date', | ||
BUILD = 'build', | ||
SEMVER = 'semver', | ||
ADOPTION = 'adoption', |
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.
@philipphofmann can you confirm that we would like to provide all these sort by options?
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.
I would remove crash-free-users and crash-free-session, as we are filtering releases for performance data, and I don't think that is relevant. I would keep the rest.
function getSortRealesesBy( | ||
sort: ReleasesSortByOption, | ||
environments: string[] | ||
): ReleasesSortByOption { | ||
// Require 1 environment for date adopted | ||
if (sort === ReleasesSortOption.ADOPTION && environments.length !== 1) { | ||
return ReleasesSortOption.DATE; | ||
} | ||
|
||
const sortExists = Object.keys(SORT_BY_OPTIONS).includes(sort ?? ''); | ||
|
||
if (sortExists) { | ||
return sort; | ||
} | ||
|
||
return ReleasesSortOption.DATE; | ||
} |
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.
you can find the same logic here
…tor/introduce-sort-by-selector
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #82302 +/- ##
===========================================
- Coverage 87.56% 80.41% -7.15%
===========================================
Files 9410 7289 -2121
Lines 536906 319467 -217439
Branches 21118 20862 -256
===========================================
- Hits 470131 256914 -213217
+ Misses 66409 62148 -4261
- Partials 366 405 +39 |
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.
@priscilawebdev @philipphofmann How about we save the sorting preference in the local storage so that it's remembered?
…-sort-by-selector' of github.com:getsentry/sentry into priscila/feat/screen-summary/releses-selector/introduce-sort-by-selector
@matejminar we can, but it won't be consistent with what we do on the releases page for example. We perform the queries based on the URLs parameters |
Thinking about it...since users should navigate these pages more, it seems like a good idea...will just wait for @philipphofmann thumbs up |
I think that would make sense unless it's a lot of work. |
Bundle ReportChanges will increase total bundle size by 5.24kB (0.02%) ⬆️. This is within the configured threshold ✅ Detailed changes
|
@matejminar we always get only 50 releases and the selected time range only affects the second request |
Yeah, that's what I was afraid of. In that case I'd completely remove sort by Number of Events. |
hey @matejminar yes it makes sense as it is not a true sorting. I have removed the option in the commit |
@priscilawebdev I just did a quick drive-by review, none of my comments are blocking, so feel free to merge this once someone approves it :) |
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.
Makes sense! All I have is nits. Out of curiosity, where did the designs come from?
static/app/views/insights/common/components/releaseSelector.tsx
Outdated
Show resolved
Hide resolved
useEffect(() => { | ||
if (urlStoragedReleaseBy === localStoragedReleaseBy) { | ||
return; | ||
} | ||
|
||
// this is useful in case the user shares the url with another user | ||
// and the user has a different sort by in their local storage | ||
if (!urlStoragedReleaseBy) { | ||
navigate( | ||
{ | ||
...location, | ||
query: { | ||
...location.query, | ||
sortReleasesBy: localStoragedReleaseBy, | ||
}, | ||
}, | ||
{replace: true} | ||
); | ||
return; | ||
} | ||
|
||
setLocalStoragedReleaseBy(urlStoragedReleaseBy); | ||
}, [ |
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.
I have a question about this! React documentation is very explicit that renders must be pure (though I guess in this case, it's not a huge deal). Maybe this is a good case for useLayoutEffect
, since it block browser paint?
…tor/introduce-sort-by-selector
@gggritso Since there is a plan to refactor this page |
The only UX issue with this change is that, if no primary or secondary release is selected, I had a solution in mind that addresses this issue (see below), but when no releases are returned based on the selected sortBy option, we would need to always display the label "Sorted By ...." anyways. To implement this, we would have to refactor the compact selector core component, which we prefer not to do since this is intended to be a temporary solution. Screen.Recording.2025-01-02.at.15.05.49.mov@gggritso do you have any thoughts on this? |
e32c3aa
to
c2d43bf
Compare
@priscilawebdev 🤔 I have two questions!
Is it possible to update
When does this happen? Is this caused by a server error, or is this a condition that might be caused by the user? |
@gggritso here the first answer:
I initially considered this approach and implemented exactly what you suggested, which resolves the issue in the release selector. However, we don’t want the entire page to change based on the selected sortBy option. While we could address the problem just for the release selector, it would look odd to have a mismatch between the selected releases and the displayed data |
…tor/introduce-sort-by-selector
For example, when selecting the "Build Number" sort option, I always get a response with 50 data items. However, when performing the |
@priscilawebdev I took a quick look! A few things came up
As for your original question, sorry, I don't have a good suggestions for how to resolve the weird UI if you don't think using the sort works. This would be better answered by someone from Design or someone who worked/works on the module, as you said. If it were me, I might just leave it alone. The behaviour is weird, yes, but it's the same behaviour as when you chose a date range far in the past, or a short date range with no events, etc. Otherwise, maybe talk to Vu about supporting empty sections in |
@gggritso thanks so much for taking a look at this! 🙏 I always assumed that a release in Sentry always contained events, so this was really helpful to clarify. As for the dropdown, I might just leave it as is for now, since these components are due for a refactor soon anyway. Hopefully, that’ll be happening sooner rather than later! |
…tor/introduce-sort-by-selector
Before
Screen.Recording.2024-12-18.at.14.38.29.mov
After
Screen.Recording.2024-12-18.at.14.39.09.mov
closes #82004