|
| 1 | +import { debounce } from 'lodash' |
1 | 2 | import { |
2 | 3 | Dispatch, |
3 | 4 | FC, |
@@ -45,7 +46,6 @@ import { FccFrame } from './fcc-frame' |
45 | 46 | import { FccSidebar } from './fcc-sidebar' |
46 | 47 | import { TitleNav } from './title-nav' |
47 | 48 | import styles from './FreeCodeCamp.module.scss' |
48 | | -import { debounce } from 'lodash' |
49 | 49 |
|
50 | 50 | const FreeCodeCamp: FC<{}> = () => { |
51 | 51 |
|
@@ -212,6 +212,7 @@ const FreeCodeCamp: FC<{}> = () => { |
212 | 212 | profile?.userId, |
213 | 213 | ]) |
214 | 214 |
|
| 215 | + // eslint-disable-next-line react-hooks/exhaustive-deps |
215 | 216 | const handleFccLessonComplete: (challengeUuid: string) => void = useCallback(debounce((challengeUuid: string) => { |
216 | 217 |
|
217 | 218 | const currentLesson: { [key: string]: string } = { |
@@ -274,30 +275,18 @@ const FreeCodeCamp: FC<{}> = () => { |
274 | 275 |
|
275 | 276 | // This is the last lesson to be completed in the first module completed, |
276 | 277 | // so it's time to trigger the survey |
277 | | - const surveyTrigger: string = 'TCA First Module Completed' |
278 | | - |
279 | | - // If there is only one assessment in a cert (e.g. Data Analysis w/Python), |
280 | | - // the cert is also completed, which redirects the user to the cert page. |
281 | | - // So the survey needs to be delayed so that it appears on the completed |
282 | | - // cert page instead of the current lesson. |
283 | | - |
284 | | - // NOTE: we can't use the cert's status here bc it doesn't get set to |
285 | | - // completed until the UI notices the cert is complete and initiates |
286 | | - // the completion. And we have to use >= instead of === because it's |
287 | | - // possible TCA data isn't in sync w/the latest FCC curriculum. |
288 | | - if (progress.certificationProgressPercentage >= 100) { |
289 | | - setTimeout(async () => { |
290 | | - surveyTriggerForUser(surveyTrigger, profile?.userId) |
291 | | - }, 1000) |
292 | | - } else { |
293 | | - surveyTriggerForUser(surveyTrigger, profile?.userId) |
294 | | - } |
| 278 | + // NOTE: We have to add a delay, otherwise the survey closes when the user |
| 279 | + // is automatically redirected to the next lesson. |
| 280 | + setTimeout(async () => { |
| 281 | + surveyTriggerForUser('TCA First Module Completed', profile?.userId) |
| 282 | + }, 1000) |
295 | 283 | } |
296 | 284 |
|
297 | 285 | /** |
298 | 286 | * Handle the navigation away from the last step of the course in the FCC frame |
299 | 287 | * @returns |
300 | 288 | */ |
| 289 | + // eslint-disable-next-line react-hooks/exhaustive-deps |
301 | 290 | const handleFccLastLessonNavigation: () => void = useCallback(debounce(() => { |
302 | 291 |
|
303 | 292 | if (!certificateProgress) { |
|
0 commit comments