We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 690ca49 + 172215b commit 5b41f50Copy full SHA for 5b41f50
src/ChatSession.tsx
@@ -144,7 +144,12 @@ function ChatSession(): JSX.Element {
144
console.error(`Index ${index} is out of bounds`);
145
} else {
146
modifiedEntries.splice(index, 1);
147
- setEntries(modifiedEntries);
+ // Re-index the remaining entries to maintain ID-to-index consistency
148
+ const reindexedEntries = modifiedEntries.map((entry, newIndex) => ({
149
+ ...entry,
150
+ id: newIndex
151
+ }));
152
+ setEntries(reindexedEntries);
153
}
154
},
155
[entries],
0 commit comments