-
Notifications
You must be signed in to change notification settings - Fork 8.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
[Security Solution][Notes] - ensures that notes are always sorted from newest to oldest in expandable flyout notes tab #188400
[Security Solution][Notes] - ensures that notes are always sorted from newest to oldest in expandable flyout notes tab #188400
Conversation
Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations) |
bf0efda
to
188257a
Compare
return notes | ||
.filter((note: Note) => note.eventId === documentId) | ||
.sort((a: Note, b: Note) => | ||
// @ts-ignore Object is possibly null or undefined |
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.
nit: would prefer we remove this, otherwise everything lgtm 👍
…m newest to oldest in expandable flyout notes tab
188257a
to
7c40a31
Compare
💚 Build Succeeded
Metrics [docs]Async chunks
|
…m newest to oldest in expandable flyout notes tab (elastic#188400) (cherry picked from commit d58de3d)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…ted from newest to oldest in expandable flyout notes tab (#188400) (#188776) # Backport This will backport the following commits from `main` to `8.15`: - [[Security Solution][Notes] - ensures that notes are always sorted from newest to oldest in expandable flyout notes tab (#188400)](#188400) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Philippe Oberti","email":"philippe.oberti@elastic.co"},"sourceCommit":{"committedDate":"2024-07-19T17:13:01Z","message":"[Security Solution][Notes] - ensures that notes are always sorted from newest to oldest in expandable flyout notes tab (#188400)","sha":"d58de3dc317ae57d05c0b03d23b550a01328efb5","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Threat Hunting:Investigations","v8.15.0","v8.16.0"],"title":"[Security Solution][Notes] - ensures that notes are always sorted from newest to oldest in expandable flyout notes tab","number":188400,"url":"#188400 Solution][Notes] - ensures that notes are always sorted from newest to oldest in expandable flyout notes tab (#188400)","sha":"d58de3dc317ae57d05c0b03d23b550a01328efb5"}},"sourceBranch":"main","suggestedTargetBranches":["8.15"],"targetPullRequestStates":[{"branch":"8.15","label":"v8.15.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"#188400 Solution][Notes] - ensures that notes are always sorted from newest to oldest in expandable flyout notes tab (#188400)","sha":"d58de3dc317ae57d05c0b03d23b550a01328efb5"}}]}] BACKPORT--> Co-authored-by: Philippe Oberti <philippe.oberti@elastic.co>
Summary
This PR fixes an issue in the expandable flyout new Notes tab, where the notes were not always sorted from newest notes at the top to oldest notes at the bottom.
The issue came from the fact that the redux slice of state for notes is shared between the notes displayed throughout Security Solution tables and flyouts as well as the notes management page. When the notes management page fetches notes sorted by a field and a direction, the result comes back sorted from the server, and is saved as is in redux. If a user visited a flyout after having been to the notes management page, there was a chance the notes wouldn't be sorted correctly.
The PR adds a new selector that allows developers to fetch notes by document id, sorted by field and direction.
Checklist
https://github.com/elastic/security-team/issues/9942