Skip to content

Commit

Permalink
fix: negate check while trying to discard (#4653)
Browse files Browse the repository at this point in the history
  • Loading branch information
Palanikannan1437 authored May 30, 2024
1 parent 87de913 commit 4d9cd0c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const InboxIssueCreateRoot: FC<TInboxIssueCreateRoot> = observer((props)
const handleFormSubmit = async (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();

if (descriptionEditorRef.current?.isEditorReadyToDiscard()) {
if (!descriptionEditorRef.current?.isEditorReadyToDiscard()) {
setToast({
type: TOAST_TYPE.ERROR,
title: "Error!",
Expand Down
4 changes: 2 additions & 2 deletions web/components/issues/issue-modal/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
const { getProjectById } = useProject();
const { areEstimatesEnabledForProject } = useEstimate();

function handleKeyDown(event: KeyboardEvent) {
const handleKeyDown = (event: KeyboardEvent) => {
if (editorRef.current?.isEditorReadyToDiscard()) {
onClose();
} else {
Expand All @@ -133,7 +133,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
});
event.preventDefault(); // Prevent default action if editor is not ready to discard
}
}
};

useKeypress("Escape", handleKeyDown);

Expand Down

0 comments on commit 4d9cd0c

Please sign in to comment.