Closed dimbslmh closed 2 years ago
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/5AoS6F5EiiKkxPGS7A5BWAowRzQb
✅ Preview: https://overflow-git-fork-dimbslmh-use-layout-effect-react-component.vercel.app
Merging #18 (f08b0a4) into master (1bccbe8) will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## master #18 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 6 +2
Lines 200 207 +7
Branches 62 67 +5
=========================================
+ Hits 200 207 +7
Impacted Files | Coverage Δ | |
---|---|---|
src/Overflow.tsx | 100.00% <100.00%> (ø) |
|
src/hooks/useLayoutEffect.tsx | 100.00% <100.00%> (ø) |
|
src/utils/commonUtil.ts | 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...f08b0a4. Read the comment docs.
Seems it should move to rc-util
since too many place need this.
Seems it should move to
rc-util
since too many place need this.
@zombieJ yeah. there seems to be a PR already covering this case done by @yoyo837 https://github.com/react-component/util/pull/252
@zombieJ please check out this search: https://github.com/search?q=org%3Areact-component+useLayoutEffect&type=code.
As you said, multiple packages are using the React.useLayoutEffect hook. There are different approaches in other packages:
react-component/select uses isClient in '../utils/commonUtil'
export const isClient =
typeof window !== 'undefined' && window.document && window.document.documentElement;
react-component/motion, react-component/input-number are using canUseDom in 'rc-util/lib/Dom/canUseDom'
export default function canUseDom() {
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
}
What would you like to do?
Since this warning is useless, pick strict one is enough for test env?
If you want to be able to test useLayoutEffect in the test environment you could use this: https://www.npmjs.com/package/jest-react-hooks-shallow
Please merge this branch if it's working as expected and resolving the warning issue. https://github.com/react-component/overflow/issues/6
Since this warning is useless, pick strict one is enough for test env?
Hi! When will the fix be released?
https://github.com/react-component/util/pull/252 merged. Can move to rc-util instead
Fixes #6