Skip to content

Commit

Permalink
Fallback to legacy graph with unlimited sides polygon (#1362)
Browse files Browse the repository at this point in the history
## Summary:
Polygon graphs are almost fully migrated, but work on the unlimited sides feature is not slated to be completed until later. To allow us to move foward with Polygon QE and play testing, we are adding a fallback to the legacy graph for when `numSides` is set to `unlimited`. This can be easily removed once the unlimited sides feature is implemented.

Issue: LEMS-2105

## Test plan:
- Open local host storybook and navigate to the [Interactive Graph Editor withMafs story](http://localhost:6006/?path=/story/perseuseditor-widgets-interactive-graph-editor--with-mafs)
- Confirm the Line Segment graph is using Mafs
- Change the graph type to Polygon and confirm it is also using Mafs
- Change number of sides to a new number. Confirm it is a Mafs graph. Change number of sides to unlimited. Confirm it is a legacy graph.
- Change back to a specific number of sides and confirm it reverts to a Mafs graph. Change to another graph type and confirm it is also still a Mafs graph.
- Confirm all checks pass.

Author: Myranae

Reviewers: benchristel, SonicScrewdriver

Required Reviewers:

Approved By: benchristel

Checks: ✅ gerald, ✅ codecov/project, ✅ Upload Coverage (ubuntu-latest, 20.x), ⏭️  Publish npm snapshot, ✅ Cypress (ubuntu-latest, 20.x), ✅ Jest Coverage (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ gerald, ✅ codecov/patch, ✅ Upload Coverage (ubuntu-latest, 20.x), ⏭️  Publish npm snapshot, ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Jest Coverage (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), 🚫 Upload Coverage, ✅ gerald, 🚫 Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ⏭️  Publish npm snapshot, 🚫 Cypress (ubuntu-latest, 20.x), 🚫 Jest Coverage (ubuntu-latest, 20.x), 🚫 Check for .changeset entries for all changed files (ubuntu-latest, 20.x), 🚫 Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ gerald

Pull Request URL: #1362
  • Loading branch information
Myranae authored Jun 20, 2024
1 parent c6c5064 commit 4bb2b87
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-owls-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": minor
---

Polygon interactive graphs use the legacy graph when numSides is set to unlimited
12 changes: 12 additions & 0 deletions packages/perseus/src/widgets/interactive-graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1815,6 +1815,18 @@ class InteractiveGraph extends React.Component<Props, State> {
}

render() {
if (
this.props.graph.type === "polygon" &&
this.props.graph.numSides === "unlimited"
) {
return (
<LegacyInteractiveGraph
ref={this.legacyGraphRef}
{...this.props}
/>
);
}

// Mafs shim
if (this.props.apiOptions?.flags?.["mafs"]?.[this.props.graph.type]) {
const box = getInteractiveBoxFromSizeClass(
Expand Down

0 comments on commit 4bb2b87

Please sign in to comment.