prevent selectChatIndex -1 error

This commit is contained in:
2023-03-16 23:36:19 +08:00
parent 772e9ac612
commit 1c8a3e1462
2 changed files with 3 additions and 1 deletions

View File

@@ -129,7 +129,7 @@ export function App() {
);
setSelectedChatIndex(0);
} else {
setSelectedChatIndex(selectedChatIndex - 1);
setSelectedChatIndex(Math.max(selectedChatIndex - 1, 0));
}
setAllChatStore([...allChatStore]);
}}