diff --git a/frontend/components/applicant/applicantNode/Label.component.tsx b/frontend/components/applicant/applicantNode/Label.component.tsx index 0329265d..076bad0b 100644 --- a/frontend/components/applicant/applicantNode/Label.component.tsx +++ b/frontend/components/applicant/applicantNode/Label.component.tsx @@ -18,7 +18,7 @@ interface ApplicantLabelProps { const ApplicantLabel = ({ postId, generation }: ApplicantLabelProps) => { const [openAdditional, setOpenAdditional] = useState(false); - const { data, error, isLoading } = useQuery( + const { data, error, isLoading } = useQuery( ["applicantLabel", postId], () => getApplicantLabel(postId), { @@ -38,6 +38,8 @@ const ApplicantLabel = ({ postId, generation }: ApplicantLabelProps) => { setOpenAdditional((prev) => !prev); }; + const omitLabels = openAdditional ? data : data.slice(0, 6); + return (
@@ -48,25 +50,14 @@ const ApplicantLabel = ({ postId, generation }: ApplicantLabelProps) => {
- {openAdditional - ? data.map((label) => ( - - )) - : data - .map((label) => ( - - )) - .slice(0, 6)} + {omitLabels.map((label) => ( + + ))}