ref(issues): Rename filterThreadInfo to getThreadInfo#113971
Merged
ref(issues): Rename filterThreadInfo to getThreadInfo#113971
Conversation
The thread selector kept a local `currentThread` state seeded from the `activeThread` prop on mount and only updated it from `onChange`. When navigating between events the prop changed but local state didn't, so the "pin selected thread to top" logic looked up a stale id, got -1 back from findIndex, and the slice math produced a mangled list (last thread missing at the front, others duplicated). Drop the redundant state and key the memo off `activeThread` directly. Guard the -1 case so a missing match just returns the sorted list. Memoize `items` while here since it was rebuilding `<Option>` JSX on every render. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
collapse the three useMemos into one, fold the asc/desc duplication in the sort comparator into a direction multiplier, and pin the active thread to the top in place instead of spreading a new array. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
the function derives info from a thread, it doesn't filter anything. While here, use the existing getFileName util instead of a local copy, inline the getRelevantFrame helper (only used here), and type the stacktrace properly so the any and the "this should not happen" fallback go away. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
evanpurkhiser
approved these changes
Apr 24, 2026
roggenkemper
approved these changes
Apr 24, 2026
the helper was only called once, and the `details` arg was unused when the thread already had a name. inline it as a ternary so we skip the getThreadInfo call entirely on the happy path. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
# Conflicts: # static/app/components/events/interfaces/threads/threadSelector/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No filtering takes place. Rename function + file to
getThreadInfo.While here:
getFileNameutil fromdebugMeta/utilsinstead of the localtrimFilenamecopy (bonus: handles Windows paths)getRelevantFrameinto this file since this was the only calleranyand the "this should not happen" fallback can go away, and usefindLastfor the in-app searchStacked on #113946.