make the parts of state being using more explicit #19968
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is an attempt to make the usage of
levelsByLesson
a little bit clearer.Previously, that method was only used by callers that passed in redux state (via. store.progress). Recently, we added a new usage for the progress tab where we pass it an object we've constructed that is a subset of the redux state.
This change makes it a little more explicit what
levelsByLesson
requires. Rather than just taking astate
as input, it takes an object of a specific shape.I've also been playing around with the idea of starting to use redux for the progress tab, even though we don't necessarily need to. The arguments for doing so would be:
(a) We're already going to have redux on the page (since other tabs need it)
(b) It might be less confusing to have just one way of doing things, rather than sometimes having the data in redux and sometimes having nearly the same data not in redux.
The idea I've been considering, if we were to use redux, would be to extract
progress.stages
into its own reducer. This would be a really boring reducer, as we initialize it, and then doing nothing else with it. In the case of script overview/puzzle pages,stageReducer
would be a child ofprogressReducer
(i.e. we would still have state.progress.stages). In the case of the progress tab, it would be a top level reducer, and we would just havestate.stages
.That said, I'm not sure all this really puts things in a more understandable state, so I'm not sure it's worth doing.