feat: introduce useRewindLogic hook for conversation history navigation - #15716
Conversation
Summary of ChangesHello @Adib234, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a core React hook, Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces the useRewindLogic hook and its corresponding tests. The overall structure is good. I've provided feedback on the hook's implementation to improve its correctness and performance by ensuring function references are stable with useCallback and by making the message selection logic more robust. The accompanying tests are well-written.
0c36d2a to
035a2a4
Compare
37c0ec4 to
b16120c
Compare
035a2a4 to
e8f0bd2
Compare
|
Size Change: -2 B (0%) Total Size: 22.3 MB ℹ️ View Unchanged
|
| } | ||
| } | ||
| return prompts; | ||
| }, [conversation.messages]); |
There was a problem hiding this comment.
warning: this isn't safe if conversation.messages can be mutated (e.g. has messages added to it).
There was a problem hiding this comment.
Removed interactions
| }, []); | ||
|
|
||
| return { | ||
| interactions, |
There was a problem hiding this comment.
if we can avoid adding interactions to the public api that would be good. would allow avoiding memoizing it within this class.
There was a problem hiding this comment.
Removed interactions, I'll derive it in the UI component later on
| type FileChangeStats, | ||
| } from '../utils/rewindFileOps.js'; | ||
|
|
||
| export function useRewindLogic(conversation: ConversationRecord) { |
There was a problem hiding this comment.
nit: remove Logic from the name. Every hook is logic... it is a filler word. Might call this "useRewind"
…versation history navigation (google-gemini#15716)

Summary
This PR adds the useRewindLogic React hook, which centralizes the state and logic for selecting rewind points in a conversation. It enables the CLI UI to display user interactions, calculate their individual turn stats, and determine the cumulative file system impact when preparing for a history rewind.
Details
The
useRewindLogichook serves as the core state manager for the rewind feature's UI components:Related Issues
After this PR gets merged here are the other PRs that will get merged in order
#15717
#15718
#15720
How to Validate
Pre-Merge Checklist