Skip to content

Commit f26d5cc

Browse files
committed
fix: correct task history slicing order for prompt navigation
Task history was using .slice(-100) which gets the newest 100 tasks, but we want to show oldest tasks first when navigating. Changed to .slice(0, 100) to get the oldest 100 tasks instead. This ensures that when starting fresh (no conversation), up arrow shows the oldest task prompts first, which is the intended behavior.
1 parent 19abea3 commit f26d5cc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

webview-ui/src/components/chat/hooks/usePromptHistory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ export const usePromptHistory = ({
9191
return item.task && item.task.trim() !== "" && (!item.workspace || item.workspace === cwd)
9292
})
9393
.map((item) => item.task)
94-
// Limit history size to prevent memory issues
95-
.slice(-MAX_PROMPT_HISTORY_SIZE)
94+
// Limit history size to prevent memory issues - take oldest tasks first
95+
.slice(0, MAX_PROMPT_HISTORY_SIZE)
9696
// No reverse - keep chronological order so up arrow shows older tasks first
9797

9898
return taskPrompts

0 commit comments

Comments
 (0)