fix(amazonq): Ensure file tree displays all files with correct state … #5083
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.
Types of changes
Description
Problem: When you 1) accept/reject a subset of changes and then 2) accept remaining changes, the file tree is updated to only display the subset of remaining files from 2 that were just accepted. (The files from 1 disappear.) This change is caused due to filtering on an
insertCodecall's inputs which was introduced with file-level accept. The filtering was attempting to avoid overwriting already-inserted changes (e.g. if the user edited an file after accepting it, and then accepted remaining changes), but actually is not necessary becauseinsertCodefilters internally.The problem is confused by a misuse of
insertCodeto insert a single file (where it is passed one file), as well as all remaining files (where it must be passed all files -- not just remaining files).Solution: There is already a kludge to re-render the file tree after inserting a single file. This change removes the incorrect filter when inserting remaining changes. As a follow up, we need to clean up the use of
insertCodeand separate this responsibility.Checklist
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.