From 92bad606417831a39996c152eda45e29d861b81e Mon Sep 17 00:00:00 2001 From: Pedro Oliveira Date: Tue, 13 Feb 2024 17:12:45 +0000 Subject: [PATCH] fix: check if the topic clicked is in the correct topicGroup --- .../registration/topicSelection/TopicSelection.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/registration/topicSelection/TopicSelection.tsx b/src/components/registration/topicSelection/TopicSelection.tsx index 6fd3409df..042621ed2 100644 --- a/src/components/registration/topicSelection/TopicSelection.tsx +++ b/src/components/registration/topicSelection/TopicSelection.tsx @@ -45,11 +45,16 @@ export const TopicSelection: VFC<{ const [topics, setTopics] = useState([]); const [isLoading, setIsLoading] = useState(false); const [listView, setListView] = useState(false); + const [topicGroupId, setTopicGroupId] = useState(0); const getTopic = (mainTopicId: number) => { return topics?.filter((topic) => topic?.id === mainTopicId)?.[0]; }; + const getTopicInteraction = (topicGroupId: number) => { + setTopicGroupId(topicGroupId); + }; + useEffect(() => { if ( REGISTRATION_DATA_VALIDATION.mainTopicId.validation( @@ -347,10 +352,15 @@ export const TopicSelection: VFC<{ topic?.id } ); + getTopicInteraction( + topicGroup.id + ); }} checked={ value === - topic?.id + topic?.id && + topicGroup.id === + topicGroupId } /> } @@ -411,7 +421,7 @@ export const TopicSelection: VFC<{ ))} - ))} + ))} )}