Skip to content

Commit

Permalink
Merge pull request #47813 from Krishna2323/krishna2323/issue/46865
Browse files Browse the repository at this point in the history
fix: Workspace - Submit button loads infinitely and is not deactivated while offline.
  • Loading branch information
aldo-expensify authored Aug 23, 2024
2 parents 194f197 + 85b6d15 commit 844c6bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/FeedbackSurvey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ type FeedbackSurveyProps = {

/** Indicates whether a loading indicator should be shown */
isLoading?: boolean;

/** Should the submit button be enabled when offline */
enabledWhenOffline?: boolean;
};

function FeedbackSurvey({title, description, onSubmit, optionRowStyles, footerText, isNoteRequired, isLoading, formID}: FeedbackSurveyProps) {
function FeedbackSurvey({title, description, onSubmit, optionRowStyles, footerText, isNoteRequired, isLoading, formID, enabledWhenOffline = true}: FeedbackSurveyProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const [draft, draftResults] = useOnyx(`${formID}Draft`);
Expand Down Expand Up @@ -103,7 +106,7 @@ function FeedbackSurvey({title, description, onSubmit, optionRowStyles, footerTe
onSubmit={handleSubmit}
submitButtonText={translate('common.submit')}
isSubmitButtonVisible={false}
enabledWhenOffline
enabledWhenOffline={enabledWhenOffline}
>
<View style={styles.mh5}>
<Text style={styles.textHeadline}>{title}</Text>
Expand Down Expand Up @@ -138,7 +141,7 @@ function FeedbackSurvey({title, description, onSubmit, optionRowStyles, footerTe
onSubmit={handleSubmit}
message={translate('common.error.pleaseCompleteForm')}
buttonText={translate('common.submit')}
enabledWhenOffline
enabledWhenOffline={enabledWhenOffline}
containerStyles={styles.mt3}
isLoading={isLoading}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ function RequestEarlyCancellationPage() {
footerText={<Text style={[styles.mb2, styles.mt4]}>{acknowledgementText}</Text>}
isNoteRequired
isLoading={isLoading}
enabledWhenOffline={false}
/>
),
[acknowledgementText, isLoading, styles.flex1, styles.mb2, styles.mt4, translate],
Expand Down

0 comments on commit 844c6bf

Please sign in to comment.