Skip to content

fix: do not use useLayoutEffect if not on client #16

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

Closed
wants to merge 1 commit into from

Conversation

nelsliu9121
Copy link

Fixes #6

fix: import error

fix: reset indent
@vercel
Copy link

vercel bot commented Jun 24, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/overflow/6DAjFbqGmRNgHL6t2KSms3pisp5j
✅ Preview: https://overflow-git-fork-nelsliu9121-master-react-component.vercel.app

@codecov
Copy link

codecov bot commented Jun 30, 2021

Codecov Report

Merging #16 (cc27e69) into master (1bccbe8) will decrease coverage by 0.49%.
The diff coverage is 83.33%.

Impacted file tree graph

@@             Coverage Diff             @@
##            master      #16      +/-   ##
===========================================
- Coverage   100.00%   99.50%   -0.50%     
===========================================
  Files            4        5       +1     
  Lines          200      204       +4     
  Branches        62       64       +2     
===========================================
+ Hits           200      203       +3     
- Misses           0        1       +1     
Impacted Files Coverage Δ
src/hooks/useIsomorphicLayoutEffect.ts 75.00% <75.00%> (ø)
src/Overflow.tsx 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

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

@afc163
Copy link
Member

afc163 commented Jul 2, 2021

Please add test case.

图片

@nelsliu9121
Copy link
Author

I am not certain if this is test-able while the JSDom is enabled in Jest. 😞

The same thing happened in react-component/select where the line is ignored by test coverage. See this line.

I could be wrong with this, but I do not have enough experience in testing useLayoutEffect, and I would love to have someone to come in and fix it. 😃

@ahallora
Copy link

I would ignore it like we do on select and get this PR merged. 🙏 @afc163 WDYT? 😄

@sb-lee
Copy link

sb-lee commented Aug 4, 2021

Are you reviewing this PR? @zombieJ 🙏 🙏 🙏 🙏 🙏 🙏
I want to know why not merge.

cc. @afc163

@nelsliu9121
Copy link
Author

Should I add the comment which will tell the test coverage to ignore the line, just like how react-component/select did?

@ahallora
Copy link

ahallora commented Sep 2, 2021

@afc163 / @zombieJ - I would happily help you with this, but I simply can't fathom it. Do you have 2 minutes to take a look? 🙏

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.

useLayoutEffect does nothing on the server
5 participants