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

Revert PR #1654 #1663

Merged
merged 2 commits into from
Sep 24, 2024
Merged

Revert PR #1654 #1663

merged 2 commits into from
Sep 24, 2024

Conversation

benchristel
Copy link
Member

@benchristel benchristel commented Sep 24, 2024

The linked PR caused a bug where certain interactive graph types would lose key features
after you interacted with them:

  • Polygon graphs would lose angle and side labels
  • Unlimited point graphs would only let you add a single point

The cause was that the interactive graph widget was passing incomplete data to
its onChange callback. The Renderer stored this data in its state, overwriting the
original widget config. The borked data then got passed back down to the widget on the
next render, which caused the features to disappear.

Issue: none

Test plan:

yarn dev; open http://localhost:5173

Turn on Mafs for the unlimited point and polygon graphs. Play with the graphs and
confirm that everything looks OK.

@khan-actions-bot
Copy link
Contributor

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/ten-seas-chew.md, packages/perseus/src/types.ts, packages/perseus/src/widgets/interactive-graph.tsx, packages/perseus/src/widgets/interactive-graphs/stateful-mafs-graph.tsx

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

@khan-actions-bot khan-actions-bot requested a review from a team September 24, 2024 19:41
Copy link
Contributor

npm Snapshot: Published

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

Example:

yarn add @khanacademy/perseus@PR1663

If you are working in Khan Academy's webapp, you can run:

./dev/tools/bump_perseus_version.sh -t PR1663

Copy link
Contributor

github-actions bot commented Sep 24, 2024

Size Change: -156 B (-0.02%)

Total Size: 863 kB

Filename Size Change
packages/perseus/dist/es/index.js 418 kB -156 B (-0.04%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.3 kB
packages/keypad-context/dist/es/index.js 760 B
packages/kmath/dist/es/index.js 4.27 kB
packages/math-input/dist/es/index.js 78 kB
packages/math-input/dist/es/strings.js 1.79 kB
packages/perseus-core/dist/es/index.js 1.48 kB
packages/perseus-editor/dist/es/index.js 279 kB
packages/perseus-linter/dist/es/index.js 22.2 kB
packages/perseus/dist/es/strings.js 3.36 kB
packages/pure-markdown/dist/es/index.js 3.66 kB
packages/simple-markdown/dist/es/index.js 12.4 kB

compressed-size-action

Copy link

codecov bot commented Sep 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.68%. Comparing base (3dcb1fd) to head (99a52a9).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1663      +/-   ##
==========================================
- Coverage   70.89%   70.68%   -0.22%     
==========================================
  Files         562      587      +25     
  Lines      108291   112784    +4493     
  Branches     7981    12007    +4026     
==========================================
+ Hits        76774    79717    +2943     
- Misses      31330    33067    +1737     
+ Partials      187        0     -187     

Impacted file tree graph

see 1148 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3dcb1fd...99a52a9. Read the comment docs.

@benchristel benchristel merged commit 1642ad9 into main Sep 24, 2024
17 of 21 checks passed
@benchristel benchristel deleted the benc/hotfix branch September 24, 2024 20:15
benchristel added a commit that referenced this pull request Sep 24, 2024
This reverts commit 1642ad9.
benchristel added a commit that referenced this pull request Sep 27, 2024
This reverts commit 1642ad9.
benchristel added a commit that referenced this pull request Sep 27, 2024
This change was previously implemented in PR #1654, then reverted in #1663 due
to a bug. This PR reimplements the change without the bug. The original PR
summary follows.

---

Previously, we were passing the entire Mafs graph state to onChange. Since
the onChange callback data is used by the Interactive Graph widget editor to
set the correct answer for the graph, a bunch of extra data like
"hasBeenInteractedWith": true was getting saved in the correct field of
the Widget data.

This extra data is not used, so its presence in datastore is potentially
confusing to future maintainers trying to understand the data. It might
also cause bugs in the future - e.g. if some code merges it into another
object in which those properties are meaningful.

This PR ensures that we only save relevant data in the correct field of
interactive graph widgets.

Issue: none

## Test plan:

`yarn dev; open http://localhost:5173`

Play around with the graphs on the dev UI gallery page. In particular:

- Unlimited point
- Polygons with angle and side labels
- Polygons with side snapping

You should not observe any issues.

Edit, save and publish an interactive graph widget in an exercise. As a
learner, you should be able to complete the exercise successfully.

Author: benchristel

Reviewers: jeremywiebe, nicolecomputer

Required Reviewers:

Approved By: jeremywiebe

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ gerald

Pull Request URL: #1664
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants