-
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
Fix classroom form state #75
Conversation
… Fix React warning
Note: I'm not really sure why all those commits are showing up... It looks like something odd happened while rebasing. I can squash those if you want me too... or we can squash on merge. |
@@ -141,7 +141,7 @@ Effect('getClassroomsAndAssignments', (selectedProgram) => { | |||
// loop through the number of pages to request all of the data | |||
// and concatenate the response data together for the app state | |||
// Neither Pagination nor infinite scroll would be good UX for current table design. | |||
Actions.getAssignments(classroom.id); | |||
Actions.getAssignments({ classroomId: classroom.id, selectedProgram }); |
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.
Out of curiosity, is there any reason the function getAssignments()
is structured like getAssignments(data)
where data = {classroomId, selectedProgram}
instead of getAssignments(classroomId, selectedProgram)
?
It's functionally the same, but from a readability standpoint, it's not very clear what arguments/values getAssignments()
is expecting.
The only advantages that I can see for using a single 'compound variable' instead of spelling out the different variables are if:
- the compound variable (
data
) supports different kinds of key-values (e.g. an advanced search query,data = {color:'red', species:'dragon', optionalAge: null }
), or - the
data
is structured in a specific way that doesn't matter to the function(), but matters to the API (e.g. createAssignnments())
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.
Jumpstate's Effect either wasn't designed to work or had a bug when I tried to pass it two separate arguments! 😢
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.
Oh gods, that's right! I totally forgot about Jumpstate's "one Effect, one argument" rule. 🤦♂️
@shaunanoordin thanks for catching that. There is an edge case of I2A classrooms that do not have assignments. These may have been created while there was that issue with the API with linking assignments correctly. zootester1 has one of these classrooms. I moved the code to sort the assignments out into its own function and do a existential check on the assignments first before returning the sorted assignments. |
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.
PR Review
- This PR fixes an issue with the Create Classroom form, which would sometimes remember values from the previous Create Classroom attempt.
- Another issue related to I2A Classrooms without Assignments was also addressed within the PR itself.
- Also, note: a polyfill service was added as a part of this PR. (I didn't realise we were missing this; I should run some tests on IE11 soon.)
Status
LGTM, approving and merging 👍
This does two things: