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 fetching of company contacts in joblisting editor #4599

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ivarnakken
Copy link
Member

Description

Two issues fixed here. When creating a new joblisting, the company contacts would not be fetched since the company id would be in company.value instead of company.id. Secondly, once you've managed to fetch, you would also get an error since it was trying to map over the payload instead of the results.

Also,

Result

  • Changes look good on both light and dark theme.
  • Changes look good with different viewports (mobile, tablet, etc.).
  • Changes look good with slower Internet connections.

No visual changes.

Testing

  • I have thoroughly tested my changes.

Editing and creating joblistings now work without any errors.

@ivarnakken ivarnakken added review-needed Pull requests that need review bug-fix Pull requests that fix a bug labels Mar 23, 2024
@ivarnakken ivarnakken requested a review from a team March 23, 2024 19:27
@ivarnakken ivarnakken self-assigned this Mar 23, 2024
Copy link

linear bot commented Mar 23, 2024

Comment on lines -227 to -234
form.change('joblistingEditor', {
label: 'Ingen',
value: null,
});
form.change('responsible', {
label: 'Ingen',
value: null,
});
Copy link
Member Author

Choose a reason for hiding this comment

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

No idea why this was here

Copy link
Member

@eikhr eikhr Mar 28, 2024

Choose a reason for hiding this comment

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

I think we need the 'responsible' one. If you change the company, there will be a different set of responsible persons (Kontaktpersoner) to choose from. So if we have selected a responsible person from company A and then change to company B we need to clear the clear the field to ensure that the responsible person is from the correct company.

Copy link
Member Author

Choose a reason for hiding this comment

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

ah yes that actually makes sense haha

return dispatch(
fetchCompanyContacts({
companyId: company.id,
companyId: 'value' in company ? company.value : company.id,
Copy link
Contributor

Choose a reason for hiding this comment

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

When tyring to save changes, I get the following error: right-hand side of 'in' should be an object, got number. According to Google, you have to do something like this instead:(Object.values(companyj).indexOf('value') > -1)

).then((action) => {
const responsibleOptions = action.payload.map((contact) => ({
).then((res) => {
const responsibleOptions = res.payload.results.map((contact) => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

I get a TypeScript error here. The payload is given the CompanyContact[]-type even though the type should really be given to .results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix Pull requests that fix a bug review-needed Pull requests that need review
Projects
None yet
3 participants