Skip to content

Conversation

@jmgasper
Copy link
Collaborator

Refactored the HomeTab in wallet to keep under lint complexity complaints and also fixed how it handles errors that are objects, not strings, which was causing a problem loading the page.

Also includes a fix to the review UI where a recent fix caused reviews to not show in certain cases.

@jmgasper jmgasper requested a review from kkartunov as a code owner October 30, 2025 04:47
@jmgasper jmgasper merged commit 8e53f50 into dev Oct 30, 2025
4 of 6 checks passed
return false
}

if (fragment === 'iterative' && hasExplicitReviewPhase) {

Choose a reason for hiding this comment

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

[⚠️ correctness]
The check for fragment === 'iterative' is case-sensitive. If there is any chance that fragment could be in a different case (e.g., 'Iterative'), consider normalizing the case of fragment before comparison to ensure consistency.

)
}
}, [walletDetails])
const balanceSum = useMemo(

Choose a reason for hiding this comment

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

[⚠️ performance]
Using useMemo here is appropriate for performance optimization, but ensure that walletDetails.account.balances is not mutated elsewhere in the component lifecycle, as it could lead to stale values being used.

if (typeof error === 'string') {
errorMessage = error
} else if (error && typeof error === 'object' && 'message' in error) {
errorMessage = (error as Error).message || errorMessage

Choose a reason for hiding this comment

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

[⚠️ correctness]
The error handling logic assumes that the error object has a message property. Consider adding a type guard or validation to ensure this property exists to avoid potential runtime errors.

export interface Response<T> {
data?: Readonly<T>
error?: Readonly<string>
error?: Readonly<Error> | string

Choose a reason for hiding this comment

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

[⚠️ correctness]
Changing error to Readonly<Error> | string allows for more flexibility, but ensure that all parts of the code handling this error property can correctly process both Error objects and strings. This change might require additional checks or transformations where error is used to avoid runtime issues.

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.

2 participants