diff --git a/packages/fakeyou.com/src/components/common/SelectionBubblesV2/SelectionBubblesV2.tsx b/packages/fakeyou.com/src/components/common/SelectionBubblesV2/SelectionBubblesV2.tsx index f613fbb34c..aaa450dfe9 100644 --- a/packages/fakeyou.com/src/components/common/SelectionBubblesV2/SelectionBubblesV2.tsx +++ b/packages/fakeyou.com/src/components/common/SelectionBubblesV2/SelectionBubblesV2.tsx @@ -36,10 +36,10 @@ export default function SelectionBubblesV2({ const bubblesRef = useRef(null); const handleSelect = ( - event: React.MouseEvent, + event: React.MouseEvent | null, optionLabel: string ) => { - event.preventDefault(); + event?.preventDefault(); setSelectedOption(optionLabel); onSelect(optionLabel); }; @@ -71,6 +71,13 @@ export default function SelectionBubblesV2({ return () => window.removeEventListener("resize", handleResize); }, []); + useEffect(() => { + if (options.length > 0 && selectedOption !== null) { + onSelect(options[0].label); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + return (
{ - const selectedOption = styleOptions[selected]; + const handleStyleSelection = (selectedLabel: any) => { + const selectedOption = styleOptions.find( + option => option.label === selectedLabel + ); const selectedSdModelToken = selectedOption ? selectedOption.token : null; if (selectedSdModelToken) { setVstValues(curr => ({ ...curr, sdModelToken: selectedSdModelToken }));