[CORE-240] Cannot Submit If only OAuth Question#38
[CORE-240] Cannot Submit If only OAuth Question#38nikkalin1008 wants to merge 4 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a form fill-out edge case where submission fails when the form contains only an OAuth question (i.e., no “answer payload” is generated), within the form response submission flow.
Changes:
- Adjust fill-out required-field validation and submission payload handling to allow submitting with an empty answers payload.
- Center the OAuth connect popup window on screen.
- Minor editor/UI tweaks: React key placement for “other” option row; remove inline comments in question option types; refactor question sync to preserve local options.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/shared/components/AccountButton/AccountButton.tsx | Centers OAuth popup via computed left/top window features. |
| src/features/form/components/FormFilloutPage.tsx | Allows submit when buildAnswersPayload returns null by sending an empty answers array; tweaks required validation logic. |
| src/features/form/components/AdminFormDetailPages/types/question.ts | Removes inline comments from Option/DetailOption types. |
| src/features/form/components/AdminFormDetailPages/components/OptionsQuestion.tsx | Moves key to the correct wrapper element for the “other” option row. |
| src/features/form/components/AdminFormDetailPages/SectionEditPage.tsx | Refactors API sync of question state to preserve local option arrays. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const NO_ANSWER_REQUIRED_TYPES: string[] = ["OAUTH_CONNECT"]; | ||
|
|
||
| // Validate required fields across all non-preview sections | ||
| const realSections = sections.filter(s => s.id !== "preview"); | ||
| for (let i = 0; i < realSections.length; i++) { | ||
| const section = realSections[i]; | ||
| const missingQuestion = section.questions?.find(q => { | ||
| if (!q.required) return false; | ||
| if (NO_ANSWER_REQUIRED_TYPES.includes(q.type)) return false; |
There was a problem hiding this comment.
Required-field validation now skips OAUTH_CONNECT questions entirely. This allows submitting the form even when an OAuth question is marked required but the user hasn’t actually connected (the value would be empty). Instead of bypassing required validation for this type, keep the normal required check and only special-case the submit payload (e.g., allow an empty answers array when all collected answers are excluded types like OAUTH_CONNECT/UPLOAD_FILE).
| const NO_ANSWER_REQUIRED_TYPES: string[] = ["OAUTH_CONNECT"]; | |
| // Validate required fields across all non-preview sections | |
| const realSections = sections.filter(s => s.id !== "preview"); | |
| for (let i = 0; i < realSections.length; i++) { | |
| const section = realSections[i]; | |
| const missingQuestion = section.questions?.find(q => { | |
| if (!q.required) return false; | |
| if (NO_ANSWER_REQUIRED_TYPES.includes(q.type)) return false; | |
| // Validate required fields across all non-preview sections | |
| const realSections = sections.filter(s => s.id !== "preview"); | |
| for (let i = 0; i < realSections.length; i++) { | |
| const section = realSections[i]; | |
| const missingQuestion = section.questions?.find(q => { | |
| if (!q.required) return false; |
Type of changes
Purpose