feat(autofix): Collapse changed-files list after 3 files - #122487
Open
NicoHinderling wants to merge 4 commits into
Open
feat(autofix): Collapse changed-files list after 3 files#122487NicoHinderling wants to merge 4 commits into
NicoHinderling wants to merge 4 commits into
Conversation
The Review Open PRs cards on the Autofix Overview page list every file changed by a PR, which can produce a long, noisy list. Show only the first 3 files per repo group and add an inline "Show N more files" toggle to reveal the rest, keeping cards compact by default. The logic lives in the shared ChangedFilesSection, so both the PR file list and the generated Code Changes list get the same behavior. The repo header badge still reflects the total file count.
Drop the up/down chevron from the "Show N more files" toggle and use a plain link-variant button, matching Sentry's house pattern for in-place list expansion. The chevron clashed with the per-row disclosure chevrons. Also remove the redundant file-count badge next to each repo name.
The flush-left link read as a stray link. Render the "Show N more files" toggle as a centered, muted footer row with a subtle hover affordance instead, so it reads as part of the file list.
Raise the collapse threshold from 3 to 5, so the "Show N more files" toggle only appears when a repo group has more than 5 files. Smaller lists render in full.
Comment on lines
+53
to
+58
| const [showAll, setShowAll] = useState(false); | ||
| const hiddenCount = group.files.length - COLLAPSED_FILE_COUNT; | ||
| const visibleFiles = | ||
| showAll || hiddenCount <= 0 | ||
| ? group.files | ||
| : group.files.slice(0, COLLAPSED_FILE_COUNT); |
Contributor
There was a problem hiding this comment.
Bug: When collapsing the file list, keys for expanded files that become hidden are not removed from expandedKeys, causing them to auto-expand when the list is revealed again.
Severity: LOW
Suggested Fix
When the showAll state is toggled to false, iterate through the files that are being hidden and remove their corresponding keys from the expandedKeys set. This can be accomplished within the RepoGroup component, possibly using a useEffect hook that triggers when showAll changes, to call onToggle(key, false) for each hidden file.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: static/app/views/seerWorkflows/overview/changedFilesSection.tsx#L53-L58
Potential issue: The `expandedKeys` state, which tracks which files have their diffs
expanded, is not cleared when the file list is collapsed. If a user expands a file that
is only visible when the full list is shown (e.g., file #6 in a list of 7) and then
collapses the list using the "Show fewer" button, the key for that file remains in the
`expandedKeys` set. When the user re-expands the list, the file will unexpectedly render
in an expanded state without any user interaction, because the component finds the stale
key and sets `isExpanded` to `true`.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
On the Autofix Overview page, the "Review Open PRs" cards list every file changed by a PR under Code Changes. For PRs touching many files this produces a long, noisy list that dominates the card.
This collapses each repo group's file list to the first 3 files by default, with an inline toggle to reveal the rest:
Show N more files/Show fewertoggle that expands and collapses inline (no navigation, no extra fetch).The logic lives in the shared
ChangedFilesSection, so both the PR file list (PullRequestFiles) and the generatedCode Changeslist get the same behavior. Per-groupshowAllstate is owned by an extractedRepoGroupcomponent; the existing expand-to-diff / prefetch flow is unchanged. The toggle carriesaria-expandedfor screen-reader semantics.