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

add useMemo to KeypadContext provider #764

Merged
merged 2 commits into from
Oct 25, 2023
Merged

add useMemo to KeypadContext provider #764

merged 2 commits into from
Oct 25, 2023

Conversation

handeyeco
Copy link
Contributor

Summary:

Issue: XXX-XXXX

Test plan:

@handeyeco handeyeco self-assigned this Oct 13, 2023
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Oct 13, 2023

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/calm-pears-judge.md, packages/math-input/src/components/keypad-context.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 October 13, 2023 18:41
@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2023

Size Change: +2.89 kB (0%)

Total Size: 855 kB

Filename Size Change
packages/math-input/dist/es/index.js 107 kB +2.67 kB (+3%)
packages/perseus/dist/es/index.js 398 kB +216 B (0%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.1 kB
packages/kmath/dist/es/index.js 4.25 kB
packages/perseus-core/dist/es/index.js 905 B
packages/perseus-editor/dist/es/index.js 268 kB
packages/perseus-error/dist/es/index.js 847 B
packages/perseus-linter/dist/es/index.js 21.4 kB
packages/pure-markdown/dist/es/index.js 3.77 kB
packages/simple-markdown/dist/es/index.js 12.3 kB

compressed-size-action

Copy link
Member

@somewhatabstract somewhatabstract left a comment

Choose a reason for hiding this comment

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

LGTM. Needs a changeset to make sure version gets bumped.

Comment on lines +42 to +63
const memoizedValue = useMemo(
() => ({
keypadActive,
setKeypadActive,
keypadElement,
setKeypadElement,
renderer,
setRenderer,
scrollableElement,
setScrollableElement,
}),
[
keypadActive,
setKeypadActive,
keypadElement,
setKeypadElement,
renderer,
setRenderer,
scrollableElement,
setScrollableElement,
],
);
Copy link
Member

Choose a reason for hiding this comment

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

praise: Great! Thanks for making this change.

setKeypadElement,
renderer,
setRenderer,
scrollableElement,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
scrollableElement,
// The scrollableElement options can likely be removed after
// the exercises-package is officially deprecated. They don't appear
// to be used anywhere except for the exercises-package and tests.
scrollableElement,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding of the scrollableElement has changed since we first wrote this comment and I actually don't think it's true anymore.

@codecov
Copy link

codecov bot commented Oct 13, 2023

Codecov Report

Merging #764 (a974b9e) into main (77bd12d) will increase coverage by 1.34%.
Report is 11 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #764      +/-   ##
==========================================
+ Coverage   59.63%   60.97%   +1.34%     
==========================================
  Files         480      485       +5     
  Lines      105413   105813     +400     
  Branches     6031     8763    +2732     
==========================================
+ Hits        62860    64522    +1662     
+ Misses      42553    41291    -1262     

Impacted file tree graph

Files Coverage Δ
...kages/math-input/src/components/keypad-context.tsx 100.00% <100.00%> (ø)

... and 56 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 77bd12d...a974b9e. Read the comment docs.

@github-actions
Copy link
Contributor

npm Snapshot: Published

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

Example:

yarn add @khanacademy/perseus@PR764

@handeyeco handeyeco merged commit fb84640 into main Oct 25, 2023
12 checks passed
@handeyeco handeyeco deleted the memo-keypad-context branch October 25, 2023 17:00
jeremywiebe pushed a commit that referenced this pull request Oct 26, 2023
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/[email protected]

### Minor Changes

-   [#780](#780) [`376eb0e4`](376eb0e) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Adds an `onError` callback prop to the ErrorBoundary component. Uses this new callback in the WidgetContainer component to report all widget rendering failures through the analytics API.

### Patch Changes

-   [#759](#759) [`c431c4b8`](c431c4b) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove references to unused font families


-   [#775](#775) [`cb529549`](cb52954) Thanks [@nedredmond](https://github.com/nedredmond)! - Added flag to `simpleValidate` call from Renderer to ensure we call analytics on MathInputEvaluated only when the answer is submitted


-   [#781](#781) [`9b9dfd4f`](9b9dfd4) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Fix for broken dilation tool in the Transformer Widget

-   Updated dependencies \[[`c431c4b8`](c431c4b), [`fb84640d`](fb84640), [`376eb0e4`](376eb0e), [`33cc24c3`](33cc24c)]:
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Minor Changes

-   [#780](#780) [`376eb0e4`](376eb0e) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Added 'perseus:widget-rendering-error' analytics event.

## @khanacademy/[email protected]

### Patch Changes

-   Updated dependencies \[[`376eb0e4`](376eb0e)]:
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Patch Changes

-   Updated dependencies \[[`376eb0e4`](376eb0e)]:
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Patch Changes

-   [#759](#759) [`c431c4b8`](c431c4b) Thanks [@handeyeco](https://github.com/handeyeco)! - Remove references to unused font families


-   [#764](#764) [`fb84640d`](fb84640) Thanks [@handeyeco](https://github.com/handeyeco)! - Use useMemo in keypad context to avoid needless rerenders


-   [#767](#767) [`33cc24c3`](33cc24c) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Small comment fixes in the math keypad

-   Updated dependencies \[[`376eb0e4`](376eb0e)]:
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Patch Changes

-   Updated dependencies \[[`c431c4b8`](c431c4b), [`cb529549`](cb52954), [`376eb0e4`](376eb0e), [`9b9dfd4f`](9b9dfd4), [`376eb0e4`](376eb0e)]:
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Patch Changes

-   Updated dependencies \[[`376eb0e4`](376eb0e)]:
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Patch Changes

-   Updated dependencies \[[`376eb0e4`](376eb0e)]:
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Patch Changes

-   Updated dependencies \[[`376eb0e4`](376eb0e)]:
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Patch Changes

-   Updated dependencies \[[`376eb0e4`](376eb0e)]:
    -   @khanacademy/[email protected]

Author: khan-actions-bot

Reviewers: jeremywiebe

Required Reviewers:

Approved By: jeremywiebe

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

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