-
Notifications
You must be signed in to change notification settings - Fork 139
fix: replace barrel imports for useLayoutEffect #2550
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
Conversation
|
Preview is ready. |
|
🎭 Component Tests Report is ready. |
ValeraS
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still need to use experimental.optimizePackageImports for @gravity/uikit? I believe the tree-shaking problem has been resolved (#2324) and this option is no longer needed. Could you check this, please?
| @@ -1,7 +1,7 @@ | |||
| import * as React from 'react'; | |||
|
|
|||
| import {useLayoutEffect} from '../..'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the problem is only with useListNavigation, because this import creates circular dependencies, and the other imports work fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. I've removed the changes in other files.
b39b6e5 to
c7648c4
Compare
@imsitnikov Could you check this, please? |
@dgaponov do you remember the reason of adding |
Summary
Fixed
TypeError: useLayoutEffect is not a functionerror that occurs when@gravity-ui/uikitis used with Next.jsoptimizePackageImportsoption.Problem
Error found when updating packages in
gravity-ui/landing(PR).When Next.js is configured with:
the barrel imports (
import { useLayoutEffect } from '../..') in hooks are not correctly resolved, causinguseLayoutEffectto be undefined at runtime.This breaks components like
DropdownMenu,Select, and others that useuseListNavigationinternally.