Skip to content

[CORE-240] Cannot Submit If only OAuth Question#38

Open
nikkalin1008 wants to merge 4 commits intomainfrom
fix/CORE-240-form-submit-if-only-oauth
Open

[CORE-240] Cannot Submit If only OAuth Question#38
nikkalin1008 wants to merge 4 commits intomainfrom
fix/CORE-240-form-submit-if-only-oauth

Conversation

@nikkalin1008
Copy link
Contributor

Type of changes

  • Fix

Purpose

  • Fix cannot submit if the form only have OAuth question

@nikkalin1008 nikkalin1008 changed the title [CORE-240] Can't Submit If only OAuth Question [CORE-240] Cannot Submit If only OAuth Question Mar 10, 2026
@nikkalin1008 nikkalin1008 marked this pull request as ready for review March 10, 2026 08:27
Copilot AI review requested due to automatic review settings March 10, 2026 08:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +296 to +304
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;
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
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;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants