-
Notifications
You must be signed in to change notification settings - Fork 1
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
Issues/KUI 1378 fetch data loader #369
Issues/KUI 1378 fetch data loader #369
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! But I found a bug and cleanup suggestion (remove of PlannedModules file).
<Item title={translation.courseRoundInformation.round_time_slots}> | ||
<PlannedModules courseCode={courseCode} courseRound={courseRound} selectedSemester={selectedSemester} /> | ||
<PlannedModules plannedModules={plannedModules} /> | ||
</Item> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now when call to usePlannedModules
is moved up in the tree we can remove PlannedModules.jsx completly and just use the generic html-prop to <Item>
here instead, like this:
<Item title={translation.courseRoundInformation.round_target_group} html={plannedModules} />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this file. See comment on RoundInformationInfoGrid.jsx
() => ({ | ||
basePath, | ||
courseCode, | ||
semester, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a bug, the semester prop in the params object is called selectedSemester
and not semester
, so semester is always undefined here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still doesn't work for when I'm testing...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it is still called semester in the planned modules api function. So it needs to be semester: selectedSemester,
here.
Like this:
const requestData = useMemo(
() => ({
basePath,
courseCode,
semester: selectedSemester,
applicationCode,
}),
[basePath, courseCode, selectedSemester, applicationCode]
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are absolutely right, I fixed it now; thanks for mentioning this.
@@ -1,20 +1,26 @@ | |||
import { useEffect, useState } from 'react' | |||
import { STATUS } from './api/status' | |||
|
|||
export const useApi = (apiToCall, initialApiParams, defaultValue, defaulValueIfNullResponse) => { | |||
const [apiParams, setApiParams] = useState(initialApiParams) | |||
export const useApi = (apiToCall, apiParams, defaultValue, defaulValueIfNullResponse) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really like your refactoring here ⭐️
Thanks for your great comments, I applied the required changes based on them ⭐️ |
No description provided.