Skip to content

Conversation

@aag
Copy link
Member

@aag aag commented May 28, 2025

Summary:

This commit changes the getSaveWarnings() function definition in the
Free Response widget editor to be defined using public class field syntax of
the public method syntax. Previously, this wasn't being bound
properly, so the function was unable to read this.props. Additionally,
the Free Response widget is unhidden, so that it will appear in the widgets
dropdown in the exercise editor.

The commit also adds some more type annotations and changes all methods
on the widget editor to be defined in the same way.

Issue: https://khanacademy.atlassian.net/browse/AX-1005

Test plan:

  • Load the PR's Perseus bundle in local webapp.

  • Go to the exercise editor in devadmin and verify that there is a "Free Response"
    option in the "Add a widget..." dropdown.
    image

  • Add a Free Response widget in the exercise editor and verify that it
    renders properly.
    image

This commit changes the getSaveWarnings() function definition in the
Free Response widget to be defined using public class field syntax of
the public method syntax. Previously, `this` wasn't being bound
properly, so the function was unable to read `this.props`.

The commit also adds some more type annotations and changes all methods
on the widget to be defined in the same way.

Issue: https://khanacademy.atlassian.net/browse/AX-1005

Test plan:
- Load the PR's Perseus bundle in local webapp.
- Add a Free Response widget in the exercise editor and verify that it
  renders properly.
@aag aag self-assigned this May 28, 2025
@github-actions
Copy link
Contributor

github-actions bot commented May 28, 2025

Size Change: -5 B (0%)

Total Size: 470 kB

Filename Size Change
packages/perseus-editor/dist/es/index.js 89.5 kB -6 B (-0.01%)
packages/perseus/dist/es/index.js 201 kB +1 B (0%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.7 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 5.98 kB
packages/math-input/dist/es/index.js 98.6 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-core/dist/es/index.js 19.5 kB
packages/perseus-linter/dist/es/index.js 7.05 kB
packages/perseus-score/dist/es/index.js 9.22 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/strings.js 7.54 kB
packages/pure-markdown/dist/es/index.js 1.22 kB
packages/simple-markdown/dist/es/index.js 6.72 kB

compressed-size-action

@github-actions
Copy link
Contributor

github-actions bot commented May 28, 2025

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (275e90b) and published it to npm. You
can install it using the tag PR2531.

Example:

pnpm add @khanacademy/perseus@PR2531

If you are working in Khan Academy's webapp, you can run the below command.
If this is for backend code, change the static flag (-s) from y/yes to n/no.

./dev/tools/bump_perseus_version.js -s y -t PR2531

@aag aag requested review from handeyeco, jeremywiebe and rgpass May 28, 2025 20:03
@aag aag marked this pull request as ready for review May 28, 2025 20:03
Copy link
Collaborator

@jeremywiebe jeremywiebe left a comment

Choose a reason for hiding this comment

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

Sorry. This is old code that uses refs alot. I'm unclear why this was broken because we call getSaveWarnings on the widget editor ref. Anyways, glad you figured it out.

@aag aag merged commit 7ce2931 into main May 28, 2025
19 of 23 checks passed
@aag aag deleted the fix_get_save_warnings branch May 28, 2025 22:19
benchristel pushed a commit that referenced this pull request Jun 2, 2025
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.


# Releases
## @khanacademy/math-input@26.0.0

### Major Changes

-   [#2522](#2522) [`ff2f1664d`](ff2f166) Thanks [@benchristel](https://github.com/benchristel)! - Breaking change: version `^3.0.0` of `@khanacademy/mathjax-renderer` is now
    required as a peer dep, instead of `^2.1.1`. Clients should update
    `@khanacademy/mathjax-renderer` at their convenience; nothing will immediately
    break if you stay on 2.x.x for now.

### Patch Changes

-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.

-   Updated dependencies \[[`03669d385`](03669d3), [`52ec0bfcb`](52ec0bf), [`d1b6d9a3c`](d1b6d9a), [`86ac76f79`](86ac76f), [`6b747d140`](6b747d1), [`efb99e901`](efb99e9), [`3ec658e38`](3ec658e), [`3e162e616`](3e162e6), [`0913e9397`](0913e93), [`dc864aca8`](dc864ac), [`8ece223ef`](8ece223), [`cf71982e0`](cf71982), [`239be3f6c`](239be3f), [`0d46a8599`](0d46a85), [`1c49ad243`](1c49ad2)]:
    -   @khanacademy/perseus-core@12.1.0
    -   @khanacademy/keypad-context@3.0.11
    -   @khanacademy/perseus-utils@2.0.4

## @khanacademy/perseus-editor@23.0.0

### Major Changes

-   [#2522](#2522) [`ff2f1664d`](ff2f166) Thanks [@benchristel](https://github.com/benchristel)! - Breaking change: version `^3.0.0` of `@khanacademy/mathjax-renderer` is now
    required as a peer dep, instead of `^2.1.1`. Clients should update
    `@khanacademy/mathjax-renderer` at their convenience; nothing will immediately
    break if you stay on 2.x.x for now.

### Minor Changes

-   [#2531](#2531) [`7ce293138`](7ce2931) Thanks [@aag](https://github.com/aag)! - Fix getSaveWarnings in Free Response widget and unhide it

### Patch Changes

-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.


-   [#2512](#2512) [`a2778ace8`](a2778ac) Thanks [@Myranae](https://github.com/Myranae)! - Remove preferred pop-over direction dropdown from Label Image editor

-   Updated dependencies \[[`03669d385`](03669d3), [`52ec0bfcb`](52ec0bf), [`d1b6d9a3c`](d1b6d9a), [`7ce293138`](7ce2931), [`41fcaa918`](41fcaa9), [`555d89762`](555d897), [`86ac76f79`](86ac76f), [`ff2f1664d`](ff2f166), [`6b747d140`](6b747d1), [`efb99e901`](efb99e9), [`3ec658e38`](3ec658e), [`3e162e616`](3e162e6), [`0913e9397`](0913e93), [`dc864aca8`](dc864ac), [`8ece223ef`](8ece223), [`64c89cb15`](64c89cb), [`cf71982e0`](cf71982), [`9c651172d`](9c65117), [`239be3f6c`](239be3f), [`0d46a8599`](0d46a85), [`1c49ad243`](1c49ad2)]:
    -   @khanacademy/perseus-core@12.1.0
    -   @khanacademy/perseus@63.1.0
    -   @khanacademy/math-input@26.0.0
    -   @khanacademy/kas@2.0.5
    -   @khanacademy/keypad-context@3.0.11
    -   @khanacademy/kmath@2.0.11
    -   @khanacademy/perseus-linter@3.0.11
    -   @khanacademy/perseus-score@7.0.1
    -   @khanacademy/perseus-utils@2.0.4
    -   @khanacademy/pure-markdown@2.0.5

## @khanacademy/perseus@63.1.0

### Minor Changes

-   [#2531](#2531) [`7ce293138`](7ce2931) Thanks [@aag](https://github.com/aag)! - Fix getSaveWarnings in Free Response widget and unhide it


-   [#2495](#2495) [`86ac76f79`](86ac76f) Thanks [@Myranae](https://github.com/Myranae)! - Update label image widget to handle answerless data and do some cleanup

### Patch Changes

-   [#2510](#2510) [`41fcaa918`](41fcaa9) Thanks [@ivyolamit](https://github.com/ivyolamit)! - Add tab navigation to new radio widget


-   [#2527](#2527) [`555d89762`](555d897) Thanks [@ivyolamit](https://github.com/ivyolamit)! - Support RTL in new radio widget


-   [#2443](#2443) [`64c89cb15`](64c89cb) Thanks [@anakaren-rojas](https://github.com/anakaren-rojas)! - Remove deprecated cross out functionality for Radio Choices


-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.


-   [#2515](#2515) [`9c651172d`](9c65117) Thanks [@aag](https://github.com/aag)! - Add validation for inputs that are too long to the Free Response widget


-   [#2509](#2509) [`0d46a8599`](0d46a85) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Ensure that Interactive Graph's labelLocation property can be parsed properly

-   Updated dependencies \[[`03669d385`](03669d3), [`52ec0bfcb`](52ec0bf), [`d1b6d9a3c`](d1b6d9a), [`86ac76f79`](86ac76f), [`ff2f1664d`](ff2f166), [`6b747d140`](6b747d1), [`efb99e901`](efb99e9), [`3ec658e38`](3ec658e), [`3e162e616`](3e162e6), [`0913e9397`](0913e93), [`dc864aca8`](dc864ac), [`8ece223ef`](8ece223), [`cf71982e0`](cf71982), [`9c651172d`](9c65117), [`239be3f6c`](239be3f), [`0d46a8599`](0d46a85), [`1c49ad243`](1c49ad2)]:
    -   @khanacademy/perseus-core@12.1.0
    -   @khanacademy/math-input@26.0.0
    -   @khanacademy/kas@2.0.5
    -   @khanacademy/keypad-context@3.0.11
    -   @khanacademy/kmath@2.0.11
    -   @khanacademy/perseus-linter@3.0.11
    -   @khanacademy/perseus-score@7.0.1
    -   @khanacademy/perseus-utils@2.0.4
    -   @khanacademy/pure-markdown@2.0.5
    -   @khanacademy/simple-markdown@2.0.5

## @khanacademy/perseus-core@12.1.0

### Minor Changes

-   [#2533](#2533) [`03669d385`](03669d3) Thanks [@benchristel](https://github.com/benchristel)! - Make `parseAndMigratePerseusItem` accept some legacy content items that previously caused parse errors.


-   [#2495](#2495) [`86ac76f79`](86ac76f) Thanks [@Myranae](https://github.com/Myranae)! - Update label image widget to handle answerless data and do some cleanup


-   [#2528](#2528) [`dc864aca8`](dc864ac) Thanks [@benchristel](https://github.com/benchristel)! - Add `splitPerseusItemJSON` to `@khanacademy/perseus-core`, for use in the publish pipeline.

### Patch Changes

-   [#2538](#2538) [`52ec0bfcb`](52ec0bf) Thanks [@Myranae](https://github.com/Myranae)! - Add typesafe parser for Label-image's user input type


-   [#2520](#2520) [`d1b6d9a3c`](d1b6d9a) Thanks [@Myranae](https://github.com/Myranae)! - Add parsing validation for Matrix's user input


-   [#2523](#2523) [`6b747d140`](6b747d1) Thanks [@Myranae](https://github.com/Myranae)! - Add typesafe parser for the plotter user input type


-   [#2516](#2516) [`efb99e901`](efb99e9) Thanks [@Myranae](https://github.com/Myranae)! - Add parsing validation for Categorizer's user input


-   [#2539](#2539) [`3ec658e38`](3ec658e) Thanks [@Myranae](https://github.com/Myranae)! - Add typesafe parser for Table's user input type


-   [#2536](#2536) [`3e162e616`](3e162e6) Thanks [@Myranae](https://github.com/Myranae)! - Add typesafe parser for Orderer's user input type


-   [#2521](#2521) [`0913e9397`](0913e93) Thanks [@Myranae](https://github.com/Myranae)! - Add typesafe parser for Number-line's user input type


-   [#2524](#2524) [`8ece223ef`](8ece223) Thanks [@Myranae](https://github.com/Myranae)! - Add typesafe parser for Matcher's user input type


-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.


-   [#2537](#2537) [`239be3f6c`](239be3f) Thanks [@Myranae](https://github.com/Myranae)! - Add typesafe parser for Input-number's user input type


-   [#2509](#2509) [`0d46a8599`](0d46a85) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Ensure that Interactive Graph's labelLocation property can be parsed properly


-   [#2525](#2525) [`1c49ad243`](1c49ad2) Thanks [@Myranae](https://github.com/Myranae)! - Add typesafe parser for Sorter's user input type

-   Updated dependencies \[[`cf71982e0`](cf71982)]:
    -   @khanacademy/kas@2.0.5
    -   @khanacademy/perseus-utils@2.0.4

## @khanacademy/kas@2.0.5

### Patch Changes

-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.

-   Updated dependencies \[[`cf71982e0`](cf71982)]:
    -   @khanacademy/perseus-utils@2.0.4

## @khanacademy/keypad-context@3.0.11

### Patch Changes

-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.

-   Updated dependencies \[[`03669d385`](03669d3), [`52ec0bfcb`](52ec0bf), [`d1b6d9a3c`](d1b6d9a), [`86ac76f79`](86ac76f), [`6b747d140`](6b747d1), [`efb99e901`](efb99e9), [`3ec658e38`](3ec658e), [`3e162e616`](3e162e6), [`0913e9397`](0913e93), [`dc864aca8`](dc864ac), [`8ece223ef`](8ece223), [`cf71982e0`](cf71982), [`239be3f6c`](239be3f), [`0d46a8599`](0d46a85), [`1c49ad243`](1c49ad2)]:
    -   @khanacademy/perseus-core@12.1.0
    -   @khanacademy/perseus-utils@2.0.4

## @khanacademy/kmath@2.0.11

### Patch Changes

-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.

-   Updated dependencies \[[`03669d385`](03669d3), [`52ec0bfcb`](52ec0bf), [`d1b6d9a3c`](d1b6d9a), [`86ac76f79`](86ac76f), [`6b747d140`](6b747d1), [`efb99e901`](efb99e9), [`3ec658e38`](3ec658e), [`3e162e616`](3e162e6), [`0913e9397`](0913e93), [`dc864aca8`](dc864ac), [`8ece223ef`](8ece223), [`cf71982e0`](cf71982), [`239be3f6c`](239be3f), [`0d46a8599`](0d46a85), [`1c49ad243`](1c49ad2)]:
    -   @khanacademy/perseus-core@12.1.0
    -   @khanacademy/perseus-utils@2.0.4

## @khanacademy/perseus-linter@3.0.11

### Patch Changes

-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.

-   Updated dependencies \[[`03669d385`](03669d3), [`52ec0bfcb`](52ec0bf), [`d1b6d9a3c`](d1b6d9a), [`86ac76f79`](86ac76f), [`6b747d140`](6b747d1), [`efb99e901`](efb99e9), [`3ec658e38`](3ec658e), [`3e162e616`](3e162e6), [`0913e9397`](0913e93), [`dc864aca8`](dc864ac), [`8ece223ef`](8ece223), [`cf71982e0`](cf71982), [`239be3f6c`](239be3f), [`0d46a8599`](0d46a85), [`1c49ad243`](1c49ad2)]:
    -   @khanacademy/perseus-core@12.1.0
    -   @khanacademy/perseus-utils@2.0.4

## @khanacademy/perseus-score@7.0.1

### Patch Changes

-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.


-   [#2515](#2515) [`9c651172d`](9c65117) Thanks [@aag](https://github.com/aag)! - Add validation for inputs that are too long to the Free Response widget

-   Updated dependencies \[[`03669d385`](03669d3), [`52ec0bfcb`](52ec0bf), [`d1b6d9a3c`](d1b6d9a), [`86ac76f79`](86ac76f), [`6b747d140`](6b747d1), [`efb99e901`](efb99e9), [`3ec658e38`](3ec658e), [`3e162e616`](3e162e6), [`0913e9397`](0913e93), [`dc864aca8`](dc864ac), [`8ece223ef`](8ece223), [`cf71982e0`](cf71982), [`239be3f6c`](239be3f), [`0d46a8599`](0d46a85), [`1c49ad243`](1c49ad2)]:
    -   @khanacademy/perseus-core@12.1.0
    -   @khanacademy/kas@2.0.5
    -   @khanacademy/kmath@2.0.11
    -   @khanacademy/perseus-utils@2.0.4

## @khanacademy/perseus-utils@2.0.4

### Patch Changes

-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.

## @khanacademy/pure-markdown@2.0.5

### Patch Changes

-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.

-   Updated dependencies \[[`cf71982e0`](cf71982)]:
    -   @khanacademy/perseus-utils@2.0.4
    -   @khanacademy/simple-markdown@2.0.5

## @khanacademy/simple-markdown@2.0.5

### Patch Changes

-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.

-   Updated dependencies \[[`cf71982e0`](cf71982)]:
    -   @khanacademy/perseus-utils@2.0.4

## perseus-build-settings@0.6.2

### Patch Changes

-   [#2511](#2511) [`1eaf969b9`](1eaf969) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Updates TypeScript configuration to target ES2021 instead of ES2016


-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.

## @khanacademy/perseus-dev-ui@5.4.12

### Patch Changes

-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.

-   Updated dependencies \[[`03669d385`](03669d3), [`52ec0bfcb`](52ec0bf), [`d1b6d9a3c`](d1b6d9a), [`86ac76f79`](86ac76f), [`ff2f1664d`](ff2f166), [`6b747d140`](6b747d1), [`efb99e901`](efb99e9), [`3ec658e38`](3ec658e), [`3e162e616`](3e162e6), [`0913e9397`](0913e93), [`dc864aca8`](dc864ac), [`8ece223ef`](8ece223), [`cf71982e0`](cf71982), [`239be3f6c`](239be3f), [`0d46a8599`](0d46a85), [`1c49ad243`](1c49ad2)]:
    -   @khanacademy/perseus-core@12.1.0
    -   @khanacademy/math-input@26.0.0
    -   @khanacademy/kas@2.0.5
    -   @khanacademy/kmath@2.0.11
    -   @khanacademy/perseus-linter@3.0.11
    -   @khanacademy/pure-markdown@2.0.5
    -   @khanacademy/simple-markdown@2.0.5

## jsdiff@1.0.2

### Patch Changes

-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.

## raphael@1.5.4

### Patch Changes

-   [#2519](#2519) [`cf71982e0`](cf71982) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updating wonderblock dependencies.

Author: khan-actions-bot

Reviewers: benchristel

Required Reviewers:

Approved By: benchristel

Checks: ⏭️  1 check has been skipped, ✅ 4 checks were successful

Pull Request URL: #2513
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.

3 participants