Skip to content

Commit

Permalink
fix: remove geopackageValidation from edit rester and unnecessary sho… (
Browse files Browse the repository at this point in the history
#536)

* fix: remove geopackageValidation from edit rester and unnecessary showCurtain

* fix: pr
  • Loading branch information
Eliav-Maimon authored Dec 1, 2024
1 parent a9d78ef commit 963d671
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/discrete-layer/components/layer-details/layer-datails-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
FieldConfigModelType,
LayerMetadataMixedUnion,
RecordType,
SourceValidationModelType,
} from '../../models';
import { LayersDetailsComponent } from './layer-details';
import { IngestionFields } from './ingestion-fields';
Expand Down Expand Up @@ -111,17 +110,13 @@ const InnerForm = (
const [isSelectedFiles, setIsSelectedFiles] = useState<boolean>(false);
const [firstPhaseErrors, setFirstPhaseErrors] = useState<Record<string, string[]>>({});
const [showCurtain, setShowCurtain] = useState<boolean>(true);
const [gpkgValidationError, setGpkgValidationError] = useState<string|undefined>(undefined);
// const validationWarn = useSessionStoreWatcherForm();

const getStatusErrors = useCallback((): StatusError | Record<string, unknown> => {
return {
...get(status, 'errors') as Record<string, string[]>,
...(gpkgValidationError ? {
error: [gpkgValidationError]
} : {})
...get(status, 'errors') as Record<string, string[]>
}
}, [status, gpkgValidationError]);
}, [status]);

const getYupErrors = useCallback(
(): Record<string, string[]> => {
Expand All @@ -140,13 +135,6 @@ const InnerForm = (
setShowCurtain((mode === Mode.NEW || mode === Mode.UPDATE) && !isSelectedFiles);
}, [mode, isSelectedFiles])

useEffect(() => {
setShowCurtain(
!isSelectedFiles || (isSelectedFiles &&
gpkgValidationError !== undefined)
);
}, [isSelectedFiles, gpkgValidationError]);

useEffect(() => {
setGraphQLError(mutationQueryError);
}, [mutationQueryError]);
Expand Down Expand Up @@ -221,10 +209,6 @@ const InnerForm = (
...ingestionFields,
});

setGpkgValidationError(
!(metadata.recordModel as unknown as SourceValidationModelType).isValid ? (metadata.recordModel as unknown as SourceValidationModelType).message as string : undefined
);

setGraphQLError(metadata.error);
};

Expand Down

0 comments on commit 963d671

Please sign in to comment.