Skip to content

Commit bf8ce7b

Browse files
authored
Merge pull request #155 from uw-ssec/test
[Feature]: Native Survey Json Support
2 parents 4365b64 + d59ac1a commit bf8ce7b

File tree

4 files changed

+1390
-1360
lines changed

4 files changed

+1390
-1360
lines changed

client/src/pages/Survey/Survey.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { initializeSurvey } from './utils/surveyUtils';
2626
// It uses the useEffect hook to manage side effects, such as fetching data and updating state
2727
// It uses the useGeolocated hook to get the user's geolocation
2828
const Survey = () => {
29-
const { surveyService, locationService, seedService } = useApi();
29+
const { surveyService, seedService } = useApi();
3030
const [searchParams] = useSearchParams();
3131
const surveyCodeInUrl = searchParams.get('ref');
3232
const { id: surveyObjectIdInUrl } = useParams();
@@ -43,10 +43,6 @@ const Survey = () => {
4343
// Add a ref to store the original full survey data in edit mode
4444
const originalSurveyData = useRef<any>(null);
4545

46-
// Get locations with loading state
47-
const { data: locations, isLoading: locationsLoading } =
48-
locationService.useLocations() || {};
49-
5046
// Conditionally fetch survey by referral code (only when surveyCodeInUrl exists)
5147
const { data: surveyByRefCode, isLoading: surveyByRefLoading } =
5248
surveyCodeInUrl
@@ -203,8 +199,6 @@ const Survey = () => {
203199

204200
// Check if all required data is loaded
205201
const isDataReady =
206-
!locationsLoading &&
207-
locations &&
208202
(!surveyCodeInUrl || !surveyByRefLoading) &&
209203
!parentLoading &&
210204
!surveyByObjectIdLoading;
@@ -249,7 +243,6 @@ const Survey = () => {
249243

250244
// Initialize the survey
251245
const { survey, existingData } = initializeSurvey(
252-
locations,
253246
surveyByRefCode as SurveyDocument | null,
254247
surveyByObjectId as SurveyDocument | null,
255248
parentSurvey as SurveyDocument | null,
@@ -283,7 +276,6 @@ const Survey = () => {
283276
surveyByRefCode,
284277
surveyByObjectId,
285278
parentSurvey,
286-
locations,
287279
ability
288280
]);
289281

@@ -304,7 +296,6 @@ const Survey = () => {
304296

305297
// Loading state (need to fetch all data)
306298
const isLoading =
307-
locationsLoading ||
308299
(surveyCodeInUrl && surveyByRefLoading) ||
309300
parentLoading ||
310301
// seedLoading ||

0 commit comments

Comments
 (0)