Skip to content

Conversation

@TomIsion
Copy link
Contributor

@TomIsion TomIsion commented Nov 20, 2025

Description

When add input history more than MAX_HISTORY_LENGTH, cause pre() fail, because currentIndex = MAX_HISTORY_LENGTH + 1:

function prev(currentInput: JSONContent) {
  let index = currentIndex;

  if (index === inputHistory.length) {
    setPendingInput(currentInput);
  }

  if (index > 0 && index <= inputHistory.length) {
    setCurrentIndex((prevState) => prevState - 1);
    return inputHistory[index - 1];
  }
}

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screen recording or screenshot

[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]

Tests

Small fix without unit test.


Summary by cubic

Limit currentIndex to MAX_HISTORY_LENGTH to prevent history navigation from breaking when the list exceeds the cap.

  • Bug Fixes
    • Clamp setCurrentIndex to MAX_HISTORY_LENGTH when adding a new entry.
    • Prevents prev() from hitting an out-of-range index and keeps replace behavior working.

Written for commit ff480a3. Summary will update automatically on new commits.

@TomIsion TomIsion requested a review from a team as a code owner November 20, 2025 14:09
@TomIsion TomIsion requested review from Patrick-Erichsen and removed request for a team November 20, 2025 14:09
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Nov 20, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Nov 20, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 20, 2025
@RomneyDa RomneyDa changed the title fix: useHistory currentIndex more than MAX_HISTORY_LENGTH cause replace fail fix: HOTFIX useHistory currentIndex more than MAX_HISTORY_LENGTH cause replace fail Nov 20, 2025
@RomneyDa RomneyDa added the hotfix Should be considered as a hotfix for main releases label Nov 20, 2025
@RomneyDa RomneyDa merged commit 7787685 into continuedev:main Nov 20, 2025
57 of 59 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Nov 20, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Nov 20, 2025
@sestinj
Copy link
Contributor

sestinj commented Nov 20, 2025

🎉 This PR is included in version 1.5.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor

sestinj commented Nov 20, 2025

🎉 This PR is included in version 1.35.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor

sestinj commented Nov 20, 2025

🎉 This PR is included in version 1.31.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor

sestinj commented Nov 20, 2025

🎉 This PR is included in version 1.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

hotfix Should be considered as a hotfix for main releases lgtm This PR has been approved by a maintainer released size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants