Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

Hide AI thinking indicator when viewing historical commits

Abi Raja95226ba018fe
diff --git a/frontend/src/components/thinking/ThinkingIndicator.tsx b/frontend/src/components/thinking/ThinkingIndicator.tsx
index 730ac02d..4f384058 100644
--- a/frontend/src/components/thinking/ThinkingIndicator.tsx
+++ b/frontend/src/components/thinking/ThinkingIndicator.tsx
@@ -20,7 +20,7 @@ function getLastSentence(text: string): string {
function ThinkingIndicator() {
const [isExpanded, setIsExpanded] = useState(false);
- const { head, commits } = useProjectStore();
+ const { head, commits, latestCommitHash } = useProjectStore();
const currentCommit = head ? commits[head] : null;
const selectedVariant = currentCommit
@@ -41,11 +41,19 @@ function ThinkingIndicator() {
const isThinkingInProgress = thinking.length > 0 && code.length === 0;
const isThinkingComplete = thinking.length > 0 && code.length > 0;
+ // Only show thinking for the latest commit, not historical ones
+ const isLatestCommit = head === latestCommitHash;
+
// Don't render if there's no thinking content and we're not in the waiting state
if (!thinking && !isWaiting) {
return null;
}
+ // Don't show thinking for historical commits
+ if (!isLatestCommit) {
+ return null;
+ }
+
// Determine header text
let headerText = "AI Thinking";
if (isWaiting) {
diff --git a/frontend/src/store/project-store.ts b/frontend/src/store/project-store.ts
index 83d1077e..779b9799 100644
--- a/frontend/src/store/project-store.ts
+++ b/frontend/src/store/project-store.ts
@@ -16,6 +16,7 @@ interface ProjectStore {
// Outputs
commits: Record<string, Commit>;
head: CommitHash | null;
+ latestCommitHash: CommitHash | null;
addCommit: (commit: Commit) => void;
removeCommit: (hash: CommitHash) => void;
@@ -63,6 +64,7 @@ export const useProjectStore = create<ProjectStore>((set) => ({
// Outputs
commits: {},
head: null,
+ latestCommitHash: null,
addCommit: (commit: Commit) => {
// Initialize variant statuses as 'generating' and start thinking timer
@@ -86,6 +88,7 @@ export const useProjectStore = create<ProjectStore>((set) => ({
),
[commitsWithStatus.hash]: commitsWithStatus,
},
+ latestCommitHash: commitsWithStatus.hash,
}));
},
removeCommit: (hash: CommitHash) => {
@@ -95,7 +98,7 @@ export const useProjectStore = create<ProjectStore>((set) => ({
return { commits: newCommits };
});
},
- resetCommits: () => set({ commits: {} }),
+ resetCommits: () => set({ commits: {}, latestCommitHash: null }),
appendCommitCode: (hash: CommitHash, numVariant: number, code: string) =>
set((state) => {