Skip to content

Commit

Permalink
fix: question form submitting not instantly set (#3621)
Browse files Browse the repository at this point in the history
  • Loading branch information
benfurber committed Jun 5, 2024
2 parents 9e5582a + 57902a9 commit 592489a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/pages/Question/Content/Common/QuestionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const QuestionForm = (props: IProps) => {
onSubmit={onSubmit}
mutators={{ setAllowDraftSaveFalse }}
initialValues={formValues}
render={({ submitting, handleSubmit, form, values }) => {
render={({ submitting, handleSubmit, pristine, valid, values }) => {
const numberOfImageInputsAvailable = values?.images
? Math.min(values.images.length + 1, QUESTION_MAX_IMAGES)
: 1
Expand Down Expand Up @@ -131,11 +131,8 @@ export const QuestionForm = (props: IProps) => {
mt={3}
variant="primary"
type="submit"
disabled={submitting}
onClick={(event) => {
form.mutators.setAllowDraftSaveFalse()
handleSubmit(event)
}}
disabled={submitting || pristine || !valid}
onClick={handleSubmit}
sx={{
width: '100%',
mb: ['40px', '40px', 0],
Expand Down
2 changes: 1 addition & 1 deletion src/stores/Question/question.store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class QuestionStore extends ModuleStore {
.collection<IQuestion.Item>(COLLECTION_NAME)
.doc(values?._id)

const isTitleAlreadyInUse = await !this.isTitleThatReusesSlug(
const isTitleAlreadyInUse = await this.isTitleThatReusesSlug(
values.title,
values?._id,
)
Expand Down

0 comments on commit 592489a

Please sign in to comment.