Skip to content

Commit 13a3975

Browse files
committed
fix: add instrument title to render page
1 parent bac0eeb commit 13a3975

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

apps/web/src/features/instruments/pages/InstrumentRenderPage.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { InstrumentRenderer, type InstrumentSubmitHandler } from '@opendatacaptu
77
import type { UnilingualInstrumentInfo } from '@opendatacapture/schemas/instrument';
88
import type { CreateInstrumentRecordData } from '@opendatacapture/schemas/instrument-records';
99
import axios from 'axios';
10-
import { useLocation, useNavigate, useParams } from 'react-router-dom';
10+
import { type Location, useLocation, useNavigate, useParams } from 'react-router-dom';
1111

1212
import { PageHeader } from '@/components/PageHeader';
1313
import { useInstrumentBundle } from '@/hooks/useInstrumentBundle';
@@ -20,13 +20,12 @@ export const InstrumentRenderPage = () => {
2020
const params = useParams();
2121
const navigate = useNavigate();
2222
const notifications = useNotificationsStore();
23-
const location = useLocation();
23+
const location = useLocation() as Location<{ info?: UnilingualInstrumentInfo }>;
2424
const { t } = useTranslation();
2525

2626
const instrumentBundleQuery = useInstrumentBundle(params.id!);
2727

28-
const locationState = location.state as { instrument?: undefined | UnilingualInstrumentInfo } | undefined;
29-
const title = locationState?.instrument?.details.title;
28+
const title = location.state?.info?.clientDetails?.title ?? location.state.info?.details.title;
3029

3130
useEffect(() => {
3231
if (!currentSession?.id) {

0 commit comments

Comments
 (0)