-
Notifications
You must be signed in to change notification settings - Fork 699
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
Enhanced Quizzes: Initial frontend state management API #11088
Enhanced Quizzes: Initial frontend state management API #11088
Conversation
Build Artifacts
|
fe9769f
to
720f381
Compare
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.
@nucleogenesis, the code looks good to me, and it is well-written and easy to understand.
* @throws {Error} if section not found | ||
* Deletes the given section by section_id */ | ||
function removeSection(section_id) { | ||
const updatedSections = get(allSections).filter(section => section.section_id !== section_id); |
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 looks nice.
{ section_id: get(activeSection).section_id, question_count: newQuestionCount } | ||
); | ||
updateSection({ | ||
section_id: get(activeSection).section_id, |
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.
None blocking comment: you could use a more descriptive name for the variable section
it is a bit too generic. It could be more descriptive if it were named something like currentSection
or something along that line. I believe this would keep changing too.
7472f7b
to
19038b1
Compare
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.
LGTM! Thanks @nucleogenesis
19038b1
to
3ab9f01
Compare
Summary
Sets up foundation for state management. This introduces some "types" which can be validated much like Vue's prop validators. This is here to hopefully make clear what kinds of data we're dealing with, what functions expect to take and return, etc.
The root of this is in a new composition API module
useQuizCreation
which will be the source of truth for state -- which will be initialized in the quiz creation root component. The state objects and functions can then be passed around and called to wherever that root component wants.In general, there are utilities here purpose-built for the quiz creation workflow. We can:
Follow up issues will hopefully be able to make use of this straight away and extend it with relative ease.
References
Closes #11012
Reviewer guidance
Testing checklist
PR process