Skip to content

Commit 398fde6

Browse files
committed
PROD-2620 #comment Fix when opening bug hunt drafts after opening another work type's draft, the bug hunt drafts cannot be opened
1 parent 85cbfd6 commit 398fde6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/IntakeForm.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useNavigate, Route, Routes } from "react-router-dom";
1+
import { useNavigate, Route, Routes, useLocation } from "react-router-dom";
22
import _ from "lodash";
33
import React, { useContext, useEffect, useState } from "react";
44
import { useDispatch } from "react-redux";
@@ -20,6 +20,7 @@ import { INTAKE_FORM_ROUTES as FIND_ME_DATA_INTAKE_FORM_ROUTES } from "./constan
2020
import { INTAKE_FORM_ROUTES as DATA_ADVISORY_INTAKE_FORM_ROUTES } from "./constants/products/DataAdvisory";
2121
import { INTAKE_FORM_ROUTES as WEBSITE_DESIGN_INTAKE_FORM_ROUTES } from "./constants/products/WebsiteDesign";
2222
import { INTAKE_FORM_ROUTES as WEBSITE_DESIGN_LEGACY_INTAKE_FORM_ROUTES } from "./constants/products/WebsiteDesignLegacy";
23+
import { BUG_HUNT_ROUTE } from "./constants/products/BugHunt";
2324
import { getIntakeFormChallenges } from "./services/challenge";
2425
import SelectWorkType from "./routes/SelectWorkType";
2526
import DataExploration from "./routes/Products/DataExploration";
@@ -33,6 +34,7 @@ import { profileContext, WorkType } from "../src-ts";
3334
export default function IntakeForm() {
3435

3536
const dispatch = useDispatch();
37+
const location = useLocation();
3638
const [isLoading, setIsLoading] = useState(false);
3739
const navigate = useNavigate()
3840

@@ -141,7 +143,8 @@ export default function IntakeForm() {
141143
};
142144

143145
const syncSavedData = (savedData) => {
144-
if (!savedData) return;
146+
const isBugHuntRoute = location.pathname.indexOf(BUG_HUNT_ROUTE) > -1
147+
if (!savedData || isBugHuntRoute) return;
145148
const { form, progress } = savedData;
146149
if (form) dispatch(saveForm(form));
147150
if (progress?.currentStep) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const BUG_HUNT_ROUTE = "/bug-hunt/";

0 commit comments

Comments
 (0)