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

Simplify InputWithExamples #1363

Merged
merged 3 commits into from
Jun 24, 2024
Merged

Simplify InputWithExamples #1363

merged 3 commits into from
Jun 24, 2024

Conversation

handeyeco
Copy link
Contributor

@handeyeco handeyeco commented Jun 20, 2024

Summary:

While working on LEMS-2081 I started to get the hunch that InputWithExamples didn't use MathInput or MathOutput anymore.

The only uses I could find of InputWithExamples was InputNumber and NumericInput; both had hardcoded values for type="text".

I checked in webapp and mobile too. Think we're safe to clean this up if tests are passing.

@handeyeco handeyeco self-assigned this Jun 20, 2024
@handeyeco handeyeco changed the title simplify input-with-examples Simplify InputWithExamples Jun 20, 2024
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Jun 20, 2024

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/five-kiwis-smell.md, packages/perseus/src/components/input-with-examples.tsx, packages/perseus/src/styles/perseus-renderer.less, packages/perseus/src/widgets/input-number.tsx, packages/perseus/src/widgets/numeric-input.tsx, packages/perseus/src/styles/widgets/matrix.less

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 June 20, 2024 15:56
Copy link
Contributor

github-actions bot commented Jun 20, 2024

npm Snapshot: Published

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

Example:

yarn add @khanacademy/perseus@PR1363

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

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

Copy link
Contributor

github-actions bot commented Jun 20, 2024

Size Change: +91 B (+0.01%)

Total Size: 845 kB

Filename Size Change
packages/perseus-editor/dist/es/index.js 272 kB +890 B (+0.33%)
packages/perseus/dist/es/index.js 407 kB -799 B (-0.2%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.2 kB
packages/kmath/dist/es/index.js 4.26 kB
packages/math-input/dist/es/index.js 80.1 kB
packages/math-input/dist/es/strings.js 1.73 kB
packages/perseus-core/dist/es/index.js 906 B
packages/perseus-error/dist/es/index.js 866 B
packages/perseus-linter/dist/es/index.js 21.8 kB
packages/perseus/dist/es/strings.js 3.21 kB
packages/pure-markdown/dist/es/index.js 3.67 kB
packages/simple-markdown/dist/es/index.js 12.4 kB

compressed-size-action

Copy link

codecov bot commented Jun 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.84%. Comparing base (fccb193) to head (fda118f).
Report is 9 commits behind head on main.

Current head fda118f differs from pull request most recent head 4bcbdf3

Please upload reports for the commit 4bcbdf3 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1363      +/-   ##
==========================================
+ Coverage   69.76%   70.84%   +1.07%     
==========================================
  Files         489      492       +3     
  Lines      103371   103274      -97     
  Branches     7452    11116    +3664     
==========================================
+ Hits        72121    73167    +1046     
+ Misses      31072    30107     -965     
+ Partials      178        0     -178     

Impacted file tree graph

Files Coverage Δ
...ges/perseus/src/components/input-with-examples.tsx 97.31% <100.00%> (+6.76%) ⬆️
packages/perseus/src/widgets/input-number.tsx 98.29% <ø> (+3.88%) ⬆️
packages/perseus/src/widgets/numeric-input.tsx 86.35% <ø> (-2.44%) ⬇️

... and 142 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 c6c5064...4bcbdf3. Read the comment docs.

@handeyeco handeyeco requested a review from benchristel June 20, 2024 16:10
Copy link
Member

@benchristel benchristel left a comment

Choose a reason for hiding this comment

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

LGTM! I think we should bump the major version instead of the minor, though.

@@ -19,7 +17,6 @@ import type {StyleType} from "@khanacademy/wonder-blocks-core";
const {captureScratchpadTouchStart} = Util;

type Props = {
type: "math" | "text" | "tex";
Copy link
Member

Choose a reason for hiding this comment

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

The removal of this prop will cause type errors in webapp when Perseus is updated. We'll need to bump the major version for this.

Alternatively, we could just mark this prop as deprecated, e.g.

/**
 * @deprecated type has no effect and will be removed in a future release of Perseus
 */

and release this change under a minor version bump. Then we could remove the prop in a future major release. I'd rather just bump the major version, though.

Copy link
Contributor Author

@handeyeco handeyeco Jun 20, 2024

Choose a reason for hiding this comment

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

I debated major vs minor (and even considered patch); I decided on minor since it's a change to a component and not a widget. The component is not exported, so I don't believe the external API of Perseus is changing - we're just changing how widgets consume an internal component.

I already started the upgrade process in Webapp to see if it breaks anything; if it throws errors I'll bump to major. (Right now it has issues with a flaky test, but otherwise looks good.)

Copy link
Member

Choose a reason for hiding this comment

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

Ah cool! Yes, you are totally right about it not being exported. I would actually lean toward a patch release then, since I don't think this changes any observable behavior? I.e. we're not adding a feature, just deleting dead code.

Copy link
Contributor

@nishasy nishasy left a comment

Choose a reason for hiding this comment

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

This is so weird! I also confirmed that InputWithExamples is not being used anywhere with a different type than "text", so I agree with you that this is the right way to go 👍🏽

It's odd to me that NumericInput doesn't use the type="math" version of this. And also that it uses InputWithExamples at all if it's not utilizing that?

@handeyeco
Copy link
Contributor Author

@nishasy My guess is it was code predating the math-input package (though I could totally be wrong). IIRC those widgets use that input in mobile now and content that needs complex math on desktop uses the Expression widget.

@handeyeco handeyeco merged commit e5a2dd8 into main Jun 24, 2024
11 checks passed
@handeyeco handeyeco deleted the in-w-ex-cleanup branch June 24, 2024 15:12
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.

4 participants