Skip to content

Commit

Permalink
Fix checking conflict in note creation
Browse files Browse the repository at this point in the history
  • Loading branch information
devleejb committed Aug 3, 2024
1 parent f6d4997 commit 067c2e7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/src/components/modals/CreateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ function CreateModal(props: CreateModalProps) {
const { data: conflictResult } = useCheckNameConflictQuery(debouncedNickname);

const errorMessage = useMemo(() => {
if (!enableConflictCheck) return null;

if (nickname.length < 2) {
return "Title must be at least 2 characters";
}
if (conflictResult?.conflict) {
return "Already Exists";
}
return null;
}, [nickname.length, conflictResult?.conflict]);
}, [enableConflictCheck, nickname.length, conflictResult?.conflict]);

useDebounce(
() => {
Expand Down

0 comments on commit 067c2e7

Please sign in to comment.