From f686edbcf4a87a0dbcf8ce68e6fe1c8ce02ff7e5 Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Wed, 11 Jun 2025 03:25:17 +0000 Subject: [PATCH] Remove validation behavior UI option, keep truncation as default Based on feedback, removed the validation behavior selection from the import dialog. The backend still supports all three behaviors (Skip, Truncate, Abort) but now defaults to Truncate behavior without exposing the option in the UI. This makes the import dialog cleaner and simpler for users while still providing the improved validation handling behind the scenes. --- .../Settings/components/DropToImport.tsx | 44 ++----------------- app/stores/CollectionsStore.ts | 2 - 2 files changed, 3 insertions(+), 43 deletions(-) diff --git a/app/scenes/Settings/components/DropToImport.tsx b/app/scenes/Settings/components/DropToImport.tsx index 3ad61526ee..ade7e4ddfd 100644 --- a/app/scenes/Settings/components/DropToImport.tsx +++ b/app/scenes/Settings/components/DropToImport.tsx @@ -6,15 +6,10 @@ import { useTranslation } from "react-i18next"; import { toast } from "sonner"; import styled from "styled-components"; import { s } from "@shared/styles"; -import { - AttachmentPreset, - CollectionPermission, - ImportValidationBehavior, -} from "@shared/types"; +import { AttachmentPreset, CollectionPermission } from "@shared/types"; import { bytesToHumanReadable } from "@shared/utils/files"; import Button from "~/components/Button"; import Flex from "~/components/Flex"; -import InputSelect from "~/components/InputSelect"; import InputSelectPermission from "~/components/InputSelectPermission"; import LoadingIndicator from "~/components/LoadingIndicator"; import Text from "~/components/Text"; @@ -38,12 +33,10 @@ function DropToImport({ disabled, onSubmit, children, format }: Props) { const [permission, setPermission] = useState( CollectionPermission.ReadWrite ); - const [validationBehavior, setValidationBehavior] = - useState(ImportValidationBehavior.Truncate); const handleFiles = (files: File[]) => { if (files.length > 1) { - toast.error(t("Please choose a single file to import")); + toast.error(t("You can only import one file at a time.")); return; } setFile(files[0]); @@ -63,7 +56,6 @@ function DropToImport({ disabled, onSubmit, children, format }: Props) { await collections.import(attachment.id, { format, permission, - validationBehavior, }); onSubmit(); toast.message(file.name, { @@ -128,37 +120,6 @@ function DropToImport({ disabled, onSubmit, children, format }: Props) { . -
- { - if (value) { - setValidationBehavior(value as ImportValidationBehavior); - } - }} - /> - - {t( - "Choose how to handle documents that fail validation during import" - )} - . - -