Skip to content

Commit 2e7823e

Browse files
Palanikannan1437sriramveeraghanta
authored andcommitted
fix: negate check while trying to discard (#4653)
1 parent 453984c commit 2e7823e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

web/components/inbox/modals/create-edit-modal/create-root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const InboxIssueCreateRoot: FC<TInboxIssueCreateRoot> = observer((props)
8181
const handleFormSubmit = async (event: FormEvent<HTMLFormElement>) => {
8282
event.preventDefault();
8383

84-
if (descriptionEditorRef.current?.isEditorReadyToDiscard()) {
84+
if (!descriptionEditorRef.current?.isEditorReadyToDiscard()) {
8585
setToast({
8686
type: TOAST_TYPE.ERROR,
8787
title: "Error!",

web/components/issues/issue-modal/form.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export const IssueFormRoot: FC<IssueFormProps> = observer((props) => {
122122
const { getProjectById } = useProject();
123123
const { areEstimatesEnabledForProject } = useEstimate();
124124

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

138138
useKeypress("Escape", handleKeyDown);
139139

0 commit comments

Comments
 (0)