Skip to content

Commit bf15263

Browse files
committed
fix: close issue
1 parent df15daf commit bf15263

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

web-marketplace/src/components/organisms/ProjectDashboardBanner/ProjectDashboardBanner.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState } from 'react';
2-
import { useLocation, useNavigate } from 'react-router-dom';
2+
import { useLocation } from 'react-router-dom';
33
import { useLingui } from '@lingui/react';
44
import { useMediaQuery, useTheme } from '@mui/material';
55
import { useAtom } from 'jotai';
@@ -60,7 +60,6 @@ const ProjectDashboardBanner = ({
6060
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
6161
const [projectsCurrentStep] = useAtom(projectsCurrentStepAtom);
6262
const router = useRouter();
63-
const navigate = useNavigate();
6463
const location = useLocation();
6564

6665
const truncatedPlace = truncateEnd(
@@ -218,13 +217,17 @@ const ProjectDashboardBanner = ({
218217
if (isDraft) {
219218
const currentStep =
220219
projectsCurrentStep[id] || 'basic-info';
221-
navigate(`/project-pages/${id}/${currentStep}`, {
222-
state: { from: location.pathname },
223-
});
220+
router.push(
221+
`/project-pages/${id}/${currentStep}?from=${encodeURIComponent(
222+
location.pathname,
223+
)}`,
224+
);
224225
} else {
225-
navigate(`/project-pages/${id}/edit/basic-info`, {
226-
state: { from: location.pathname },
227-
});
226+
router.push(
227+
`/project-pages/${id}/edit/basic-info?from=${encodeURIComponent(
228+
location.pathname,
229+
)}`,
230+
);
228231
}
229232
}}
230233
>

web-marketplace/src/legacy-pages/ProjectEdit/ProjectEdit.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { useCanAccessManageProjectWithRole } from 'legacy-pages/Dashboard/MyProj
2121
import { useFeeGranter } from 'legacy-pages/Dashboard/MyProjects/hooks/useFeeGranter';
2222
import NotFoundPage from 'legacy-pages/NotFound';
2323
import { startCase } from 'lodash';
24+
import { useRouter } from 'next/navigation';
2425

2526
import Banner from 'web-components/src/components/banner';
2627
import ArrowDownIcon from 'web-components/src/components/icons/ArrowDownIcon';
@@ -101,6 +102,7 @@ function ProjectEdit(): JSX.Element {
101102
const navigate = useNavigate();
102103
const graphqlClient = useApolloClient();
103104
const { queryClient } = useLedger();
105+
const router = useRouter();
104106

105107
const setProcessingModalAtom = useSetAtom(processingModalAtom);
106108
const setErrorCodeAtom = useSetAtom(errorCodeAtom);
@@ -240,10 +242,10 @@ function ProjectEdit(): JSX.Element {
240242
if (isFormDirty) {
241243
setIsWarningModalOpen(path);
242244
} else {
243-
navigate(path);
245+
router.push(path);
244246
}
245247
} else {
246-
navigate('/dashboard/projects');
248+
router.push('/dashboard/projects');
247249
}
248250
};
249251

0 commit comments

Comments
 (0)