Skip to content

Commit 5dc9d3a

Browse files
authored
Merge pull request #250 from topcoder-platform/PROD-2642_not-logged-in-form-issue
Fix for BH Log In form & Review page -> dev
2 parents 7eb6857 + bf1d2d7 commit 5dc9d3a

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

src-ts/tools/work/work-self-service/intake-forms/bug-hunt/BugHuntIntakeForm.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,10 @@ const BugHuntIntakeForm: React.FC = () => {
7474
if (!workId && !challenge) {
7575
formOnReset(formInputs, formValues)
7676
}
77-
}, [
78-
challenge,
79-
formInputs,
80-
formValues,
81-
workId,
82-
])
77+
// Disabling lint rule as we only want this to run one time when component mounts, otherwise it resets
78+
// the form for a user that is not logged in and has no challenge created yet
79+
// eslint-disable-next-line react-hooks/exhaustive-deps
80+
}, [])
8381

8482
useEffect(() => {
8583

src-ts/tools/work/work-self-service/intake-forms/review/Review.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,19 @@ const Review: FC = () => {
102102
})
103103
}
104104
getAndSetWork()
105-
}, [
106-
formFieldValues,
107-
userProfile,
108-
workId,
109-
])
105+
// Disabling to avoid infite re-renders
106+
// eslint-disable-next-line react-hooks/exhaustive-deps
107+
}, [workId])
110108

111109
useEffect(() => {
112110
setFormValues({
113111
...formFieldValues,
114112
email: profile?.email || '',
115113
name: `${profile?.firstName} ${profile?.lastName}`,
116114
})
117-
}, [
118-
formFieldValues,
119-
profile,
120-
])
115+
// Disabling to avoid infite re-renders
116+
// eslint-disable-next-line react-hooks/exhaustive-deps
117+
}, [profile])
121118

122119
const onUpdateField: (fieldName: string, value: string | boolean) => void = (fieldName, value) => {
123120
setFormValues({

0 commit comments

Comments
 (0)