The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Restore selectedOption logic
Tim Wilsonf09eb0f8ea8b
diff --git a/apps/web/ui/partners/partner-link-selector.tsx b/apps/web/ui/partners/partner-link-selector.tsxindex 5a87509a4d..f7317597d2 100644--- a/apps/web/ui/partners/partner-link-selector.tsx+++ b/apps/web/ui/partners/partner-link-selector.tsx@@ -45,17 +45,28 @@ export function PartnerLinkSelector({},);+ const { links: selectedLinks } = useLinks({+ linkIds: [selectedLinkId ?? ""],+ });+const options = useMemo(() => links?.map((link) => getLinkOption(link)),[links],);+ const selectedOption = useMemo(() => {+ const link = [...(links || []), ...(selectedLinks || [])].find(+ ({ id }) => id === selectedLinkId,+ );+ return link ? getLinkOption(link) : null;+ }, [selectedLinkId, links, selectedLinks]);+const selectedLink = links?.find((l) => l.id === selectedLinkId);return (<><Combobox- selected={options?.find((o) => o.value === selectedLinkId) ?? null}+ selected={selectedOption}setSelected={(option) => {if (option) setSelectedLinkId(option.value);}}