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

Implement React Query in RecruitmentPositionOverviewpage #1574

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

Snorre98
Copy link
Contributor

@Snorre98 Snorre98 commented Oct 30, 2024

❗ Will remove the backend part and adjust frontend logic to work with #1603

The recruitment position overview page is taking a very long time to load when there is a lot of applications for a gang.

The long loading time stems from the fact that ALL applications for the gang is fetched ong the RecruitmentPositionOverviewPage.

This PR sets out to only fetch applications realted to the position, as well as implementing react query here.

@Snorre98 Snorre98 linked an issue Oct 30, 2024 that may be closed by this pull request
@Snorre98 Snorre98 self-assigned this Oct 30, 2024
@@ -1070,26 +1070,40 @@ def put(self, request: Request, pk: int) -> Response:


class RecruitmentApplicationForRecruitmentPositionView(ModelViewSet):
# TODO: refactor this in ISSUE #1575
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I #1575 skal RecruitmentStatusChoices hentes til frontend, så de definterte filter typene her må endres når det blir gjort.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only changes here are refactoring imports and adding prop + implementation of loading state conditional rendering/disable input.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just moved

const url =
BACKEND_DOMAIN +
reverse({
pattern: ROUTES.backend.samfundet__recruitment_applications_for_gang_detail,
urlParams: { pk: recruitmentPositionId },
pattern: ROUTES.backend.samfundet__recruitment_applications_for_position_detail,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

API call was fetching the wrong data

Comment on lines +859 to +867

const params = filterType ? { filter_type: filterType } : {};

const response = await axios.get<RecruitmentApplicationDto[]>(url, {
withCredentials: true,
params: params,
});

return response.data;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adds param for filtering in backend

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactored to only fetch data related to the position. Also implemented React Query

@Snorre98 Snorre98 marked this pull request as ready for review October 31, 2024 04:20
@Snorre98
Copy link
Contributor Author

Snorre98 commented Nov 7, 2024

#1603 is better in backend. Can look at this for React Query

@Snorre98 Snorre98 closed this Nov 7, 2024
@Snorre98 Snorre98 reopened this Nov 7, 2024
@Snorre98 Snorre98 changed the title 1543 filter data fetched in recruitmentpositionoverviewpage Implement React Query in RecruitmentPositionOverviewpage Nov 7, 2024
@Snorre98 Snorre98 marked this pull request as draft November 7, 2024 17:11
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.

Filter data fetched in RecruitmentPositionOverviewPage
1 participant