diff --git a/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageFormat/ImageFormat.component.tsx b/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageFormat/ImageFormat.component.tsx index 48ab881789d2445fc5f67e5f6a7ffc6c0b7c85e1..3b735d200124c9e52ed3f8af67262a2fa2ab5ab4 100644 --- a/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageFormat/ImageFormat.component.tsx +++ b/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageFormat/ImageFormat.component.tsx @@ -4,7 +4,8 @@ import { loadingConfigurationMainSelector, } from '@/redux/configuration/configuration.selectors'; import { useAppSelector } from '@/redux/hooks/useAppSelector'; -import { useContext } from 'react'; +import { useContext, useState } from 'react'; +import { CheckboxItem } from '@/components/Map/Drawer/ExportDrawer/CheckboxFilter/CheckboxFilter.types'; import { CheckboxFilter } from '../../CheckboxFilter'; import { CollapsibleSection } from '../../CollapsibleSection'; import { ExportContext } from '../ExportCompound.context'; @@ -23,6 +24,16 @@ export const ImageFormat = (): React.ReactNode => { label: name, })); + const options = useState<CheckboxItem[]>(mappedElementAnnotations); + if ( + !isPending && + currentImageFormats.length === ZERO && + options.length > ZERO && + options[ZERO].length > ZERO + ) { + setImageFormats([options[ZERO][ZERO]]); + } + return ( <CollapsibleSection title="Image format"> {isPending && <p>Loading...</p>}