-
Notifications
You must be signed in to change notification settings - Fork 47
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 use client directive at top of client-component files #2468
Conversation
🦋 Changeset detectedLatest commit: c5f601f The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Chromatic Report🚀 Congratulations! Your build was successful! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2468 +/- ##
=======================================
Coverage 83.28% 83.28%
=======================================
Files 141 141
Lines 2943 2943
Branches 912 912
=======================================
Hits 2451 2451
- Misses 462 487 +25
+ Partials 30 5 -25 ☔ View full report in Codecov by Sentry. |
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.
- Self Checklist를 체크해주시고, 담당자와 라벨을 추가해주시면 감사하겠습니다. (잘 안되시면 알려주세요)
- radix-ui등 서드파티 라이브러리를 사용하는 컴포넌트에 use client 지시어 추가 여부가 확실치 않다면, code sandbox 등에서 Next.js App Router 셋팅 후 import하여 테스트해보면 좋을 거 같습니다!
넵. 피드백 감사합니다. |
@sungik-choi 확인 부탁드립니다~ PR 메시지에 체크박스에 대해 궁금한 점도 적었습니다.(완료시 삭제 예정) |
changeset 은 붙이는 게 좋을 것 같습니다! 마이너 버전 업으로 하는게 어떨까요? 추가하고 체크리스트 전부 확인하시고 괜찮으면 체크까지 해주세요. 혹시 어떤 기준으로 use client를 사용하셨나요? 문서를 찾아보니 ref forwarding 이나 컨텍스트를 사용하는 곳에서도 use client 를 추가하는게 맞는 것 같아서요. nextjs로 테스트 해보니 AlphaDialogPrimitive 를 사용하거나 Text 같이 이벤트 핸들러가 없는 컴포넌트라도 ref forwarding 을 하면 에러가 뜹니다. 그래서 모든 컴포넌트에 붙여야 하지 않나 생각이 듭니다. https://react.dev/reference/rsc/use-client#using-third-party-libraries |
|
아~ |
@@ -113,6 +113,13 @@ const generateConfig = ({ output = [], plugins = [] }) => | |||
minifycss(), | |||
...plugins, | |||
], | |||
onwarn(warning, warn) { | |||
// Suppress "Module level directives cause errors when bundled" warnings | |||
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') { |
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.
이대로라면 모든 MODULE_LEVEL_DIRECTIVE 워닝을 끄게 되서 "use client"까지 확인하는게 좋을것 같습니다.
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') { | |
if (warning.code === 'MODULE_LEVEL_DIRECTIVE' && warning.message.includes("use client")) { |
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.
제가 미처 생각하지 못한 것인데 좋네요! 제가 실수로 changeset을 patch로 했는데 그거와 함께 고쳐서 푸시할게요.
components that use react hook or memo...
"Module level directives cause errors when bundled" warnings
I wrote the commit message incorrectly. This reverts commit 53114f2
cac1556
to
c5f601f
Compare
LGTM |
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 ## @channel.io/bezier-react@2.4.0 ### Minor Changes - The use client directive has been added at the top of all components inside @channel.io/bezier-react. ([#2468](#2468)) by @nayounsang ### Patch Changes - Remove 1px gap between icon and text in `s` size `AlphaButton`, `AlphaFloatingButton`. ([#2484](#2484)) by @yangwooseong - Apply hovered color token for `AlphaButton`, `AlphaFloatingButton`, and `AlphaFloatingIconButton`. ([#2471](#2471)) by @yangwooseong - Add `ToggleEmojiButtonGroup` and `ToggleEmojiButtonSource` component. ([#2301](#2301)) by @yangwooseong - Updated dependencies - @channel.io/bezier-tokens@0.2.11 ## @channel.io/bezier-tokens@0.2.11 ### Patch Changes - Change `alpha-color-green-300-0` alpha token. ([#2471](#2471)) by @yangwooseong Modify hovered color generating formula so that they are more visible in dark theme. ## @channel.io/stylelint-bezier@0.2.5 ### Patch Changes - Updated dependencies - @channel.io/bezier-tokens@0.2.11 ## bezier-figma-plugin@0.6.13 ### Patch Changes - Updated dependencies - @channel.io/bezier-react@2.4.0 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
components that use react hook or memo...
Self Checklist
Related Issue
close #2456
Summary
use client
directivesDetails
use client
directives to all component fildsI am not sure about files thatRadix
exports without additional logic.Module level directives cause errors when bundled
warnings, I returned onWarn early when the warning appeared.It seemed appropriate to write it inside thegenerateConfig
.Breaking change? (Yes/No)
No
References
remix-run/remix#8891
rollup/rollup#4699