Skip to content

Commit

Permalink
simplify usage in threads
Browse files Browse the repository at this point in the history
  • Loading branch information
myandrienko committed Dec 18, 2024
1 parent 41275d9 commit 51ed4f8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,12 @@ export class Thread<SCG extends ExtendableGenerics = DefaultGenerics> {
selectKey: (reply) => reply.id,
});

const actualIndex =
replies[index]?.id === message.id ? index : replies[index - 1]?.id === message.id ? index - 1 : null;

if (actualIndex === null) {
if (replies[index]?.id !== message.id ? index : null) {
return;
}

const updatedReplies = [...replies];
updatedReplies.splice(actualIndex, 1);
updatedReplies.splice(index, 1);

this.state.partialNext({
replies: updatedReplies,
Expand Down

0 comments on commit 51ed4f8

Please sign in to comment.