Skip to content

PM-1315 Fix issues on Copilot request form #1141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2025
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
3 changes: 2 additions & 1 deletion src/apps/copilots/src/pages/copilot-request-form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ const CopilotRequestForm: FC<{}> = () => {
<h1 className={styles.heading}> Copilot Request </h1>
<p className={styles.subheading}>
Hi,
{profile?.firstName}
{' '}
{profile?.firstName}
!
This form is to request a copilot for your project. Please fill in the details below.
</p>
Expand All @@ -273,6 +273,7 @@ const CopilotRequestForm: FC<{}> = () => {
label='Project'
placeholder='Start typing the name of the project'
dirty
isClearable
error={formErrors.projectId}
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ $gradient: linear-gradient(

.skillsWrapper {
border: 1px solid #aaaaaa;
border-radius: 0.375rem;
border-radius: 0.375rem;
}

.skillsWrapper:hover {
border-color: #137D60;
}

.skillsError {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface InputSelectReactProps {
readonly async?: boolean
readonly loadOptions?: (inputValue: string, callback: (option: any) => void) => void
readonly filterOption?: (option: InputSelectOption, value: string) => boolean
readonly isClearable?: boolean
}

/**
Expand Down Expand Up @@ -105,11 +106,12 @@ const InputSelectReact: FC<InputSelectReactProps> = props => {

// throw the proper event type to the form handler (needs name & form element on target)
function handleSelect(option: unknown): void {
const selectedOption = option as InputSelectOption | null

Choose a reason for hiding this comment

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

Consider adding a type guard or checking if option is of type InputSelectOption before casting. This will ensure type safety and prevent potential runtime errors if option is not of the expected type.

props.onChange({
target: {
form: findParentFrom(wrapRef.current as HTMLDivElement),
name: props.name,
value: (option as InputSelectOption).value,
value: selectedOption?.value || '',

Choose a reason for hiding this comment

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

The use of optional chaining (?.) is a good approach to handle potential null or undefined values. However, ensure that selectedOption is always of type InputSelectOption | null to avoid unexpected behavior.

},
} as ChangeEvent<HTMLInputElement>)
}
Expand Down Expand Up @@ -162,6 +164,7 @@ const InputSelectReact: FC<InputSelectReactProps> = props => {
formatCreateLabel={props.createLabel}
onCreateOption={props.onCreateOption}
onBlur={handleBlur}
isClearable={props.isClearable}
backspaceRemovesValue
isDisabled={props.disabled}
filterOption={props.filterOption}
Expand Down