Fix issue #67: Retry / regenerate doesn't take you to new response #85
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.
This pull request fixes #67.
The changes effectively address the reported issue through two key modifications:
Added an
.onChange
modifier in GeneratedView.swift that automatically updates the prompt's generationIndex whenever a new response is added to the responses array. This ensures that when a response is regenerated, the view will automatically show the newest response (prompt.generationIndex = prompt.responses.count - 1).Added a test case (PromptGenerationTests.swift) that verifies this behavior by:
The core issue was that users had to manually navigate to new responses after regeneration. The implemented solution automatically updates the view to show the latest response by keeping the generationIndex synchronized with new responses. This is a straightforward fix that directly addresses the reported behavior without introducing complexity or potential side effects.
The changes are minimal but target the exact problem - the lack of automatic navigation to new responses - making it a focused and effective solution.
Automatic fix generated by OpenHands 🙌