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

Progress tab: fix switching sections errors #22082

Merged
merged 1 commit into from Apr 26, 2018
Merged

Conversation

caleybrock
Copy link
Contributor

@caleybrock caleybrock commented Apr 26, 2018

We were getting reports of errors occasionally when switching between sections.
image

Switching sections does not reset the state, initially it's only the list of students, so react was trying to access data that doesn't exist.

Switching sections triggers a { type: ActionTypes.INIT } action, which says it's meant to setup the state. Apparently it's an anti-pattern to do anything based on this, but the first actions we always call is SET_SECTION, so here we reset the state to the initial state (which we should've been doing anyways - the state isn't set up to contain data from multiple sections).

This fixes the errors and adds a test for it.

Copy link
Contributor

@Erin007 Erin007 left a comment

Choose a reason for hiding this comment

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

Wahoo! Nice job tracking this down and adding the test. The comment will also be really helpful down the road.

Copy link
Contributor

@islemaster islemaster left a comment

Choose a reason for hiding this comment

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

👍

@caleybrock caleybrock merged commit ad717ad into staging Apr 26, 2018
@caleybrock caleybrock deleted the fix-section-switch branch April 26, 2018 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants