diff --git a/frontend/src/components/urlInput/urlInput.tsx b/frontend/src/components/urlInput/urlInput.tsx index 338126c5e..0ed7f62a2 100644 --- a/frontend/src/components/urlInput/urlInput.tsx +++ b/frontend/src/components/urlInput/urlInput.tsx @@ -69,13 +69,14 @@ const URLInput: FC = ({ control, type, errors }) => { const handleInput = (url: string) => { if (!inputRef.current || !selectRef.current) return; - const site = - selectedSite ?? - sites.find((s) => s.regex && new RegExp(s.regex).test(url)); + const site = sites.find((s) => s.regex && new RegExp(s.regex).test(url)); if (site && selectedSite?.id !== site.id) { setSelectedSite(site); selectRef.current.value = site.id; + } else if (url && !site && selectedSite?.regex) { + setSelectedSite(undefined); + selectRef.current.value = ""; } if (site?.regex && url) { @@ -96,11 +97,6 @@ const URLInput: FC = ({ control, type, errors }) => { } }; - const handleRemove = (url: string) => { - const index = urls.findIndex((u) => u.url === url); - if (index !== -1) remove(index); - }; - const handleSiteSelect = (e: React.ChangeEvent) => { const site = sites.find((s) => s.id === e.currentTarget.value); if (site) setSelectedSite(site); @@ -112,7 +108,7 @@ const URLInput: FC = ({ control, type, errors }) => { {urls.map((u, i) => (
  • -