Skip to content
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

Fix adding new company through interest form #4162

Merged
merged 1 commit into from Oct 3, 2023

Conversation

eikhr
Copy link
Member

@eikhr eikhr commented Oct 3, 2023

Description

I think the refactor to react-final-form must have broken the feature where one could add a new company in the company interest form, if it wasn't already in our database.

Result

I made some small front-end only changes to make it send the new company name in the correct format.

Testing

  • I have thoroughly tested my changes.

I have sent in a few company interest forms to test. It works well when creating new company interests. It's a teensy bit buggy when editing the name, but do we ever do that?
I think it's fine for a quick fix.


@eikhr eikhr added the bug-fix Pull requests that fix a bug label Oct 3, 2023
@github-actions github-actions bot added the review-needed Pull requests that need review label Oct 3, 2023
@eikhr eikhr requested review from jonasdeluna and removed request for JonasBak October 3, 2023 12:15
@eikhr eikhr force-pushed the fix-company-interest-new-company branch from 6b23920 to d180b23 Compare October 3, 2023 12:15
Copy link
Member

@jonasdeluna jonasdeluna left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

app/components/Form/SelectInput.tsx Outdated Show resolved Hide resolved
@eikhr eikhr enabled auto-merge October 3, 2023 12:17
Copy link
Contributor

@falbru falbru left a comment

Choose a reason for hiding this comment

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

LGTM

@eikhr eikhr force-pushed the fix-company-interest-new-company branch from d180b23 to 16a86b4 Compare October 3, 2023 13:32
@eikhr eikhr requested a review from ollfkaih October 3, 2023 13:34
Copy link
Contributor

@ollfkaih ollfkaih left a comment

Choose a reason for hiding this comment

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

Lgtm

@eikhr eikhr force-pushed the fix-company-interest-new-company branch from 16a86b4 to c4d71c7 Compare October 3, 2023 13:36
Copy link
Member

@ivarnakken ivarnakken left a comment

Choose a reason for hiding this comment

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

If it works it works 🤷🏼

Comment on lines +110 to +121
props.isMulti = true;
}

if (creatable) {
return (
<div className={style.field}>
<Creatable
{...props}
isDisabled={disabled}
placeholder={!disabled && placeholder}
instanceId={name}
isMulti
isMulti={props.isMulti}
Copy link
Member

Choose a reason for hiding this comment

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

Picky, but might as well destruct it from props as well like the others

Comment on lines +362 to +363
const companyId = nameOnly ? null : company['value'];
const companyName = nameOnly ? company['label'] : '';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const companyId = nameOnly ? null : company['value'];
const companyName = nameOnly ? company['label'] : '';
const companyId = nameOnly ? null : company.value;
const companyName = nameOnly ? company.label : '';

Any specific reason for using squared brackets?

Copy link
Member Author

Choose a reason for hiding this comment

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

not really, just didn't change it

@@ -447,6 +459,7 @@ const CompanyInterestPage = (props: Props) => {
filter={['companies.company']}
fieldClassName={styles.metaField}
component={SelectInput.AutocompleteField}
creatable
Copy link
Member

Choose a reason for hiding this comment

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

Why not set the tags prop here? Isn't that what we want?

Copy link
Member Author

Choose a reason for hiding this comment

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

I assumed the tags-prop was referring to the fact that you can create new tags in tag-selectors. So I figured we should call it something else, as we might want to create other things than tags. Is there some other reason it's called that?

return [false, 'Du må velge en bedrift'] as const;
} else if (value['__isNew__'] || !value.value) {
return [!!value.label, 'Ny bedrift må ha et navn'] as const;
} else {
Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary else

@ivarnakken ivarnakken added the approved Pull requests that have been approved label Oct 3, 2023
@eikhr eikhr merged commit 6526aab into master Oct 3, 2023
3 of 4 checks passed
@eikhr eikhr deleted the fix-company-interest-new-company branch October 3, 2023 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Pull requests that have been approved bug-fix Pull requests that fix a bug review-needed Pull requests that need review
Projects
None yet
5 participants