fix: remove setting current index when max length is true

This commit is contained in:
trafficlunar 2025-02-08 13:35:46 +00:00
parent a80119c011
commit 614bef9008

View file

@ -31,7 +31,6 @@ export const HistoryProvider = ({ children }: Props) => {
if (newHistory.length > MAX_HISTORY) { if (newHistory.length > MAX_HISTORY) {
newHistory.shift(); newHistory.shift();
setCurrentIndex((prev) => Math.max(prev - 1, 0));
} else { } else {
setCurrentIndex(newHistory.length - 1); setCurrentIndex(newHistory.length - 1);
} }