-
Notifications
You must be signed in to change notification settings - Fork 351
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
Expose a way to get user input from ServerItemRenderer #1910
base: main
Are you sure you want to change the base?
Conversation
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (4839ebb) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1910 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1910 |
Size Change: +591 B (+0.05%) Total Size: 1.29 MB
ℹ️ View Unchanged
|
@@ -39,7 +105,7 @@ describe("emptyWidgetsFunctional", () => { | |||
it("properly identifies empty widgets", () => { | |||
// Arrange | |||
const widgets: PerseusWidgetsMap = { | |||
"dropdown 1": testDropdownWidget, | |||
"dropdown 1": getTestDropdownWidget(), |
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.
Why did this need to become a function?
Summary:
This is a repeat of PR #1753 (which was reverted in #1905)
While this PR is essentially the same as the previous one, I added prop upgrading to the scoring logic and the empty widget logic (along with some tests).
I'm trying to tread lightly, maybe being overly cautious at the expense of keeping too much old code around. I tried to make everything we can get rid of after the move with
@deprecated
.Basically this should expose everything we need to move the actual scoring process out of ServerItemRenderer and the React tree. We now have
getUserInput
onServerItemRenderer
andscorePerseusItem
which is a non-React, pure function that returns a score.Next step is to replace uses of
scoreInput
in Webapp withscorePerseusItem
; then we can come back and delete a lot of this legacy code 🤞Issue: LEMS-2665
Test plan:
After the swap in Webapp, we should be able to complete an exercise with
scorePerseusItem
and everything else will work the same.