channel-io / bezier-react

React components library that implements Bezier design system.
https://main--62bead1508281287d3c94d25.chromatic.com
Apache License 2.0
231 stars 47 forks source link

Add use client directive at top of client-component files #2468

Closed nayounsang closed 3 weeks ago

nayounsang commented 3 weeks ago

components that use react hook or memo...

Self Checklist

Related Issue

close #2456

Summary

Details

export default function Home() { return (

{/* code with radix-ui ...*/}

); }


- Add the changeset
- To ignore `Module level directives cause errors when bundled` warnings, I returned onWarn early when the warning appeared.It seemed appropriate to write it inside the `generateConfig`.

### Breaking change? (Yes/No)

<!-- If Yes, please describe the impact and migration path for users -->
No

## References

<!-- Please list any other resources or points the reviewer should be aware of -->
https://github.com/remix-run/remix/issues/8891
https://github.com/rollup/rollup/issues/4699
changeset-bot[bot] commented 3 weeks ago

๐Ÿฆ‹ Changeset detected

Latest commit: c5f601f9093f28d9697bc75bce4d5989cc7bd0e0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | ------------------------ | ----- | | @channel.io/bezier-react | Minor | | bezier-figma-plugin | Patch |

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

channeltalk[bot] commented 3 weeks ago

https://desk.channel.io/#/channels/1/team_chats/groups/1237/6720b09ab4c80d2bd6dc

github-actions[bot] commented 3 weeks ago

Chromatic Report

๐Ÿš€ Congratulations! Your build was successful!

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 83.28%. Comparing base (3954134) to head (c5f601f). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

nayounsang commented 3 weeks ago
  1. Self Checklist๋ฅผ ์ฒดํฌํ•ด์ฃผ์‹œ๊ณ , ๋‹ด๋‹น์ž์™€ ๋ผ๋ฒจ์„ ์ถ”๊ฐ€ํ•ด์ฃผ์‹œ๋ฉด ๊ฐ์‚ฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. (์ž˜ ์•ˆ๋˜์‹œ๋ฉด ์•Œ๋ ค์ฃผ์„ธ์š”)
  2. radix-ui๋“ฑ ์„œ๋“œํŒŒํ‹ฐ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์ปดํฌ๋„ŒํŠธ์— use client ์ง€์‹œ์–ด ์ถ”๊ฐ€ ์—ฌ๋ถ€๊ฐ€ ํ™•์‹ค์น˜ ์•Š๋‹ค๋ฉด, code sandbox ๋“ฑ์—์„œ Next.js App Router ์…‹ํŒ… ํ›„ importํ•˜์—ฌ ํ…Œ์ŠคํŠธํ•ด๋ณด๋ฉด ์ข‹์„ ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค!

๋„ต. ํ”ผ๋“œ๋ฐฑ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. 2๋ฒˆ์˜ ๊ฒฝ์šฐ ์ง„ํ–‰ํ•ด๋ณด๊ณ  ๋ง์”€๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค. 1๋ฒˆ์€ ์ œ๊ฐ€ assigness์™€ label ์„ค์ •์ด ์•ˆ๋ฉ๋‹ˆ๋‹ค!

nayounsang commented 3 weeks ago

@sungik-choi ํ™•์ธ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค~ PR ๋ฉ”์‹œ์ง€์— ์ฒดํฌ๋ฐ•์Šค์— ๋Œ€ํ•ด ๊ถ๊ธˆํ•œ ์ ๋„ ์ ์—ˆ์Šต๋‹ˆ๋‹ค.(์™„๋ฃŒ์‹œ ์‚ญ์ œ ์˜ˆ์ •)

yangwooseong commented 3 weeks ago

changeset ์€ ๋ถ™์ด๋Š” ๊ฒŒ ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค! ๋งˆ์ด๋„ˆ ๋ฒ„์ „ ์—…์œผ๋กœ ํ•˜๋Š”๊ฒŒ ์–ด๋–จ๊นŒ์š”? ์ถ”๊ฐ€ํ•˜๊ณ  ์ฒดํฌ๋ฆฌ์ŠคํŠธ ์ „๋ถ€ ํ™•์ธํ•˜์‹œ๊ณ  ๊ดœ์ฐฎ์œผ๋ฉด ์ฒดํฌ๊นŒ์ง€ ํ•ด์ฃผ์„ธ์š”.

ํ˜น์‹œ ์–ด๋–ค ๊ธฐ์ค€์œผ๋กœ use client๋ฅผ ์‚ฌ์šฉํ•˜์…จ๋‚˜์š”? ๋ฌธ์„œ๋ฅผ ์ฐพ์•„๋ณด๋‹ˆ ref forwarding ์ด๋‚˜ ์ปจํ…์ŠคํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ณณ์—์„œ๋„ use client ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š”๊ฒŒ ๋งž๋Š” ๊ฒƒ ๊ฐ™์•„์„œ์š”. nextjs๋กœ ํ…Œ์ŠคํŠธ ํ•ด๋ณด๋‹ˆ AlphaDialogPrimitive ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ Text ๊ฐ™์ด ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ๊ฐ€ ์—†๋Š” ์ปดํฌ๋„ŒํŠธ๋ผ๋„ ref forwarding ์„ ํ•˜๋ฉด ์—๋Ÿฌ๊ฐ€ ๋œน๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ๋ชจ๋“  ์ปดํฌ๋„ŒํŠธ์— ๋ถ™์—ฌ์•ผ ํ•˜์ง€ ์•Š๋‚˜ ์ƒ๊ฐ์ด ๋“ญ๋‹ˆ๋‹ค.

https://react.dev/reference/rsc/use-client#using-third-party-libraries

sungik-choi commented 3 weeks ago

@sungik-choi ํ™•์ธ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค~ PR ๋ฉ”์‹œ์ง€์— ์ฒดํฌ๋ฐ•์Šค์— ๋Œ€ํ•ด ๊ถ๊ธˆํ•œ ์ ๋„ ์ ์—ˆ์Šต๋‹ˆ๋‹ค.(์™„๋ฃŒ์‹œ ์‚ญ์ œ ์˜ˆ์ •)

nayounsang commented 3 weeks ago

changeset ์€ ๋ถ™์ด๋Š” ๊ฒŒ ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค! ๋งˆ์ด๋„ˆ ๋ฒ„์ „ ์—…์œผ๋กœ ํ•˜๋Š”๊ฒŒ ์–ด๋–จ๊นŒ์š”? ์ถ”๊ฐ€ํ•˜๊ณ  ์ฒดํฌ๋ฆฌ์ŠคํŠธ ์ „๋ถ€ ํ™•์ธํ•˜์‹œ๊ณ  ๊ดœ์ฐฎ์œผ๋ฉด ์ฒดํฌ๊นŒ์ง€ ํ•ด์ฃผ์„ธ์š”.

ํ˜น์‹œ ์–ด๋–ค ๊ธฐ์ค€์œผ๋กœ use client๋ฅผ ์‚ฌ์šฉํ•˜์…จ๋‚˜์š”? ๋ฌธ์„œ๋ฅผ ์ฐพ์•„๋ณด๋‹ˆ ref forwarding ์ด๋‚˜ ์ปจํ…์ŠคํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ณณ์—์„œ๋„ use client ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š”๊ฒŒ ๋งž๋Š” ๊ฒƒ ๊ฐ™์•„์„œ์š”. nextjs๋กœ ํ…Œ์ŠคํŠธ ํ•ด๋ณด๋‹ˆ AlphaDialogPrimitive ๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ Text ๊ฐ™์ด ์ด๋ฒคํŠธ ํ•ธ๋“ค๋Ÿฌ๊ฐ€ ์—†๋Š” ์ปดํฌ๋„ŒํŠธ๋ผ๋„ ref forwarding ์„ ํ•˜๋ฉด ์—๋Ÿฌ๊ฐ€ ๋œน๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ๋ชจ๋“  ์ปดํฌ๋„ŒํŠธ์— ๋ถ™์—ฌ์•ผ ํ•˜์ง€ ์•Š๋‚˜ ์ƒ๊ฐ์ด ๋“ญ๋‹ˆ๋‹ค.

https://react.dev/reference/rsc/use-client#using-third-party-libraries

์•„~ forwardRef ๋Š” ์ œ๊ฐ€ ์ž˜๋ชป ์•Œ๊ณ  ์žˆ์—ˆ๋„ค์š”. ๊ทธ๋Ÿผ ๋ชจ๋“  ์ปดํฌ๋„ŒํŠธ์— ๋ถ™ํžˆ๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์ปดํฌ๋„ŒํŠธ๊ฐ€ ๋งŽ๋‹ค๋ณด๋‹ˆ ์ปจํ…์ŠคํŠธ๋‚˜ ํ›…์„ ์‚ฌ์šฉํ•ด๋„ ์ œ๊ฐ€ ๋นผ๋จน์€๊ฒŒ ์ƒ๊ฒผ๋„ค์š”...!!

sungik-choi commented 3 weeks ago

LGTM ๊ธฐ์—ฌ ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค!