Skip to content

Conversation

@hentrymartin
Copy link
Collaborator

@hentrymartin hentrymartin commented Jan 14, 2026

Related JIRA Ticket:

https://topcoder.atlassian.net/browse/PM-3398

What's in this PR?

  • Added description and associated skills field in Add/Update Work experience modal
  • Add the same fields in work card in Profile Page

Screenshots

Screenshot 2026-01-15 at 01 34 40 Screenshot 2026-01-15 at 01 34 45 Screenshot 2026-01-15 at 01 34 51

@@ -1,7 +1,8 @@
import { Dispatch, FC, SetStateAction, useEffect, useMemo, useState } from 'react'
import { Dispatch, FC, SetStateAction, useCallback, useEffect, useMemo, useState } from 'react'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The useRef import has been removed but is still used in the code. Ensure that fetchedSkillIdsRef is no longer needed or re-import useRef if it is still required.

const workExpirence: UserTrait[] | undefined
= useMemo(() => memberWorkExpirenceTraits?.[0]?.traits?.data, [memberWorkExpirenceTraits])

// Collect all unique skill IDs from work experience entries

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ performance]
The useMemo hook is used to collect skill IDs, which is appropriate for performance optimization. However, ensure that the dependencies are correctly set to avoid unnecessary recalculations.

}, [workExpirence])

// Fetch skills using SWR hook
const { data: fetchedSkills, error: skillsError } = useSkillsByIds(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
Consider handling the case where useSkillsByIds returns an error (skillsError). Currently, the error is only used to determine the loading state, but it might be beneficial to handle or log the error for better debugging and user feedback.

return map
}, [fetchedSkills, allSkillIds])

const areSkillsLoaded = useCallback((work: UserTrait): boolean => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ performance]
The useCallback hook is used for areSkillsLoaded, which is good for preventing unnecessary re-creations of the function. Ensure that the dependencies are correctly set to avoid stale closures.


return useSWR<UserSkill[], Error>(
swrKey,
() => fetchSkillsByIdsFetcher(skillIds!),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
Using the non-null assertion operator (!) on skillIds can lead to runtime errors if skillIds is undefined. Consider adding a check or default value to ensure safety.

if (!skillIds || skillIds.length === 0) {
return null
}
return ['skills-by-ids', [...skillIds].sort().join(',')]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ performance]
Sorting skillIds before joining them into a string for the SWR key ensures consistent key generation, but it might introduce unnecessary overhead if skillIds are already sorted. Consider checking if sorting is necessary to optimize performance.

@hentrymartin hentrymartin merged commit 0d36298 into dev Jan 15, 2026
8 checks passed
@hentrymartin hentrymartin deleted the pm-3398 branch January 15, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants