Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ProfileCompleteness: FC<ProfileCompletenessProps> = props => {

const [count, incompleteEntries] = useMemo(() => {
const fields = Object.entries(completeness.entries)
.filter(([, value]) => !value)
.filter(([, value]) => value === false || value === null || value === undefined)

Choose a reason for hiding this comment

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

[💡 maintainability]
The filter condition value === false || value === null || value === undefined is technically correct, but consider using value == null to check for both null and undefined in a more concise way. This can improve readability and maintainability.

.map(([key]) => startCase(key))

if (fields.length === 2) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { omit } from 'lodash'

Choose a reason for hiding this comment

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

[⚠️ performance]
Consider using a more specific import from lodash, such as import omit from 'lodash/omit', to potentially reduce bundle size if tree-shaking is not fully effective.

import useSWR, { KeyedMutator, SWRResponse } from 'swr'

import { getProfileUrl } from '../profile-functions'
Expand All @@ -14,7 +15,7 @@ export function useProfileCompleteness(memberHandle?: string): {

const percentComplete = data?.data?.percentComplete
return {
entries: data?.data ?? {},
entries: omit(data?.data ?? {}, 'percentComplete'),
isLoading: percentComplete === undefined,
mutate,
percent: (percentComplete ?? 0) * 100,
Expand Down
Loading