diff --git a/lama_cleaner/app/src/components/SizeSelector.tsx b/lama_cleaner/app/src/components/SizeSelector.tsx index c8c8ae1..b20ceba 100644 --- a/lama_cleaner/app/src/components/SizeSelector.tsx +++ b/lama_cleaner/app/src/components/SizeSelector.tsx @@ -1,4 +1,4 @@ -import React, { FocusEvent, useCallback } from 'react' +import React, { FocusEvent, useCallback, useEffect } from 'react' import { Listbox } from '@headlessui/react' import { CheckIcon, SelectorIcon } from '@heroicons/react/solid' @@ -51,9 +51,16 @@ export default function SizeSelector(props: SizeSelectorProps) { return validSizes }, [originalHeight, originalWidth]) + const getValidSize = useCallback(() => { + if (getValidSizes().indexOf(value) === -1) { + return getValidSizes()[0] + } + return value + }, [value, getValidSizes]) + return (
- +
- {getSizeShowName(value)} + + {getSizeShowName(getValidSize())} +