Skip to content

Commit

Permalink
chore: suppresed ts warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jeafreezy committed Dec 31, 2024
1 parent dd21cbb commit e84c394
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions frontend/src/app/providers/models-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { APPLICATION_ROUTES, MODELS_BASE, MODELS_ROUTES } from "@/constants";
import { BASE_MODELS, TrainingDatasetOption, TrainingType } from "@/enums";
import { LngLatBoundsLike } from "maplibre-gl";
import { TOAST_NOTIFICATIONS } from "@/constants";
import { useCreateTrainingDataset } from "@/features/model-creation/hooks/use-training-datasets";
import { useGetTrainingDataset } from "@/features/models/hooks/use-dataset";
import { useLocation, useNavigate, useParams } from "react-router-dom";
import { useModelDetails } from "@/features/models/hooks/use-models";
import { UseMutationResult } from "@tanstack/react-query";
import { APPLICATION_ROUTES, MODELS_BASE, MODELS_ROUTES } from '@/constants';
import { BASE_MODELS, TrainingDatasetOption, TrainingType } from '@/enums';
import { LngLatBoundsLike } from 'maplibre-gl';
import { TOAST_NOTIFICATIONS } from '@/constants';
import { useCreateTrainingDataset } from '@/features/model-creation/hooks/use-training-datasets';
import { useGetTrainingDataset } from '@/features/models/hooks/use-dataset';
import { useLocation, useNavigate, useParams } from 'react-router-dom';
import { useModelDetails } from '@/features/models/hooks/use-models';
import { UseMutationResult } from '@tanstack/react-query';
import {
TTrainingAreaFeature,
TTrainingDataset,
Expand Down Expand Up @@ -224,8 +224,8 @@ const ModelsContext = createContext<{
validateEditMode: boolean;
}>({
formData: initialFormState,
setFormData: () => {},
handleChange: () => {},
setFormData: () => { },
handleChange: () => { },
createNewTrainingDatasetMutation: {} as UseMutationResult<
TTrainingDataset,
Error,
Expand All @@ -240,13 +240,13 @@ const ModelsContext = createContext<{
>,
hasLabeledTrainingAreas: false,
hasAOIsWithGeometry: false,
resetState: () => {},
resetState: () => { },
isEditMode: false,
modelId: "",
getFullPath: () => "",
handleModelCreationAndUpdate: () => {},
handleModelCreationAndUpdate: () => { },
trainingDatasetCreationInProgress: false,
handleTrainingDatasetCreation: () => {},
handleTrainingDatasetCreation: () => { },
validateEditMode: false,
});

Expand Down Expand Up @@ -275,7 +275,7 @@ export const ModelsProvider: React.FC<{
const getFullPath = (path: string) =>
`${isEditMode ? MODELS_BASE + "/" + modelId : MODELS_ROUTES.CREATE_MODEL_BASE}/${path}/`;

const timeOutRef = useRef<NodeJS.Timeout | null>(null);
const timeOutRef = useRef(null);

const isEditMode = Boolean(modelId && !pathname.includes("new"));

Expand Down Expand Up @@ -349,6 +349,7 @@ export const ModelsProvider: React.FC<{
mutationConfig: {
onSuccess: () => {
showSuccessToast(TOAST_NOTIFICATIONS.trainingRequestSubmittedSuccess);
// @ts-expect-error bad type definition
timeOutRef.current = setTimeout(() => {
setFormData(initialFormState);
}, 2000);
Expand Down

0 comments on commit e84c394

Please sign in to comment.