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

Switch from using useRef() to createRef() #1603

Merged
merged 1 commit into from
Sep 9, 2024
Merged

Conversation

jeremywiebe
Copy link
Collaborator

@jeremywiebe jeremywiebe commented Sep 6, 2024

Summary:

I noticed a test that was jumping through hoops with spies in order to manage a ref in tests. Using React.createRef() is simpler and avoids needing to mock a hook.

Issue: "none"

Test plan:

yarn test

@jeremywiebe jeremywiebe self-assigned this Sep 6, 2024
@jeremywiebe jeremywiebe marked this pull request as ready for review September 6, 2024 23:38
@khan-actions-bot
Copy link
Contributor

Gerald

Required Reviewers
  • @Khan/perseus for changes to packages/perseus-editor/src/widgets/__tests__/interactive-graph-editor.test.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 6, 2024 23:39
Copy link
Contributor

github-actions bot commented Sep 6, 2024

npm Snapshot: Published

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

Example:

yarn add @khanacademy/perseus@PR1603

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

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

Copy link
Contributor

github-actions bot commented Sep 6, 2024

Size Change: 0 B

Total Size: 859 kB

ℹ️ 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 275 kB
packages/perseus-linter/dist/es/index.js 22.2 kB
packages/perseus/dist/es/index.js 417 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 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.43%. Comparing base (eddcb94) to head (71a7ef4).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1603      +/-   ##
==========================================
- Coverage   70.52%   70.43%   -0.09%     
==========================================
  Files         547      572      +25     
  Lines      107037   111539    +4502     
  Branches     5532    11867    +6335     
==========================================
+ Hits        75485    78563    +3078     
- Misses      31436    32976    +1540     
+ Partials      116        0     -116     

Impacted file tree graph

see 1119 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 eddcb94...71a7ef4. Read the comment docs.

Copy link
Contributor

@aemandine aemandine left a comment

Choose a reason for hiding this comment

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

LGTM and this makes sense, no re-renders so createRef won't do any unwanted overwriting! Thanks for doing this, got me to look up the difference between useRef and createRef:)

@jeremywiebe jeremywiebe merged commit 9718fcc into main Sep 9, 2024
13 of 22 checks passed
@jeremywiebe jeremywiebe deleted the jer/test-fixes branch September 9, 2024 22:56
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