Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment form doesn't allow click inside after comment submit #1360

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/CommentCreateForm/CommentCreateForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ const CommentCreateForm: React.FC<CommentCreateFormProps> = ({ goalId, states, o
const [pushState, setPushState] = useState<State | undefined>();

const createComment = useCallback(
(form: GoalCommentSchema) => {
async (form: GoalCommentSchema) => {
// FIXME: maybe async/await would be better API
create(({ id }) => {
await create(({ id }) => {
onSubmit?.(id);
setPushState(undefined);
})(form);
Expand Down
9 changes: 6 additions & 3 deletions src/components/CommentForm/CommentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface CommentFormProps {
description?: string;

renderActionButton: (props: { busy?: boolean }) => React.ReactNode;
onSubmit?: (form: GoalCommentSchema) => void;
onSubmit?: (form: GoalCommentSchema) => void | Promise<void>;
onFocus?: () => void;
onCancel?: () => void;
}
Expand Down Expand Up @@ -98,11 +98,14 @@ export const CommentForm: React.FC<CommentFormProps> = ({
}, [onCancel, reset]);

const onCommentSubmit = useCallback(
(form: GoalCommentSchema) => {
async (form: GoalCommentSchema) => {
setBusy(true);
setCommentFocused(false);
onSubmit?.(form);
reset();

await onSubmit?.(form);

setBusy(false);
},
[onSubmit, reset],
);
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useCommentResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const useCommentResource = () => {
const [data] = await notifyPromise(promise, 'commentCreate');

data && cb(data);
return data;
};

const update =
Expand Down
Loading