Skip to content

Commit

Permalink
Prevent duplicate threads with the same title
Browse files Browse the repository at this point in the history
  • Loading branch information
rajku-dev committed Jan 26, 2025
1 parent 65d03c7 commit b88e5d0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/pages/Encounters/tabs/EncounterNotesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,12 @@ export const EncounterNotesTab = ({ encounter }: EncounterTabProps) => {

const handleCreateThread = (title: string) => {
if (title.trim()) {
if (
threadsData?.results.some((thread) => thread.title === title.trim())
) {
toast.error("Thread with this title already exists.");
return;
}
createThreadMutation.mutate({
title: title.trim(),
encounter: encounter.id,
Expand Down

0 comments on commit b88e5d0

Please sign in to comment.