Skip to content

Conversation

@jmgasper
Copy link
Collaborator

topcoder.atlassian.net/browse/PS-513

@jmgasper jmgasper requested a review from kkartunov as a code owner January 29, 2026 02:11
gap: 6px;
}

.dialogLoadingSpinnerContainer {

Choose a reason for hiding this comment

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

[⚠️ maintainability]
Using position: absolute; for .dialogLoadingSpinnerContainer without specifying a top, right, or bottom value other than bottom: 0; can lead to layout issues if the parent container's size changes. Consider ensuring the parent container has a defined size or constraints to prevent unexpected behavior.

@jmgasper jmgasper merged commit 2b03599 into master Jan 29, 2026
3 of 5 checks passed
props.setOpen(false)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isLoading])

Choose a reason for hiding this comment

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

[⚠️ correctness]
The handleClose function is missing props.setOpen in its dependency array. This could lead to stale closures if setOpen changes. Consider adding props.setOpen to the dependency array.

const onSubmit = useCallback(() => {
setShowConfirm(true)
}, [])
const currentHandle = props.userInfo.handle

Choose a reason for hiding this comment

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

[⚠️ correctness]
The newHandle value is derived from getValues() outside of the form submission or confirmation logic. This could lead to stale data if the form state changes before submission. Consider moving this logic inside the onSubmit or onConfirm functions.

forceUpdateValue
onChange={_.noop}
error={_.get(errors, 'newHandle.message')}
inputControl={register('newHandle')}

Choose a reason for hiding this comment

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

[💡 maintainability]
The inputControl prop is not a standard prop for InputText. If this is a custom implementation, ensure it is correctly handled within the InputText component. Otherwise, consider removing or renaming it to avoid confusion.

.then(result => {
setIsLoading(false)
toast.success('Handle updated successfully')
props.userInfo.handle = result?.handle ?? nextHandle

Choose a reason for hiding this comment

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

[⚠️ design]
Directly mutating props.userInfo.handle could lead to unexpected side effects, especially if userInfo is used elsewhere. Consider using a state update function or a context provider to manage this state change.

{showDialogEditUserHandle && (
<DialogEditUserHandle
open
setOpen={function setOpen() {

Choose a reason for hiding this comment

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

[💡 maintainability]
Consider using a consistent naming convention for the setOpen function across all dialog components. Currently, the setOpen function is defined inline with a different style compared to other similar functions in the file. This could improve maintainability by ensuring consistency.

* Model for edit user handle form
*/
export interface FormEditUserHandle {
newHandle: string

Choose a reason for hiding this comment

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

[⚠️ correctness]
Consider adding validation logic to ensure that newHandle meets expected constraints (e.g., length, allowed characters) to prevent potential issues with invalid user handles.

newHandle: string,
): Promise<MemberInfo> => {
const payload = {
newHandle: newHandle.trim(),

Choose a reason for hiding this comment

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

[⚠️ correctness]
Consider validating newHandle before trimming and sending it in the payload. This ensures that the handle meets any necessary criteria (e.g., length, character restrictions) before making the API call.

}

return xhrPatchAsync<typeof payload, MemberInfo>(
`${EnvironmentConfig.API.V6}/members/${encodeURIComponent(handle)}/change_handle`,

Choose a reason for hiding this comment

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

[❗❗ security]
Ensure that handle is validated before encoding and using it in the URL. This prevents potential issues with invalid or malicious input.

*/
export const formEditUserHandleSchema: Yup.ObjectSchema<FormEditUserHandle>
= Yup.object({
newHandle: Yup.string()

Choose a reason for hiding this comment

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

[⚠️ correctness]
Consider adding a .min(3, 'Handle must be at least 3 characters long.') constraint to ensure the handle has a minimum length. This can help prevent invalid or too short handles from being accepted.

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