-
Notifications
You must be signed in to change notification settings - Fork 141
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
chore: SmartHR UIコンポーネントからuseThemeの依存をなくす #4975
Conversation
commit: |
|
||
import presetConfig from '../../smarthr-ui-preset' | ||
|
||
export const tailwindConfig = resolveConfig(presetConfig) |
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.
すべて tailwlindConfig.theme
を読んでるので theme
を返してしまっても良さそうに思いました。
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.
使う側は import { colors } from '../../themes'
とかなるイメージ。
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.
やってみたのですが、全部を展開できなかったので、今の時点でSmartHR UIで参照している変数のみ出してみたのですがどうでしょうか・・?(ちょっと悩ましいなぁとは思っていますが動的なexportができないので😢)
15cacda
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.
SmartHR UIで参照している変数のみ出してみた
プロダクト側で拡張する場合は、自前で resolveConfig
するはずなので問題がないように思いました。smarthr-ui として export する必要もないかも?
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.
theme自体を返すのをやめた&resolveConfig結果はexport消しました!
4ce49ee
onDelete && onDelete(item) | ||
onChangeSelected && | ||
if (onDelete) onDelete(item) | ||
if (onChangeSelected) |
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.
あれ、ここフォーマッタ差分だと思いますが、 CI で lint:format
で Prettier によるチェックをしてるはずなのに、変更前後どっちもCI通るのなんでだろ。
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.
あ、そもそもフォーマット差分じゃないのか。
&&
だったのを if
に変えたんですね?
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.
そうですね。。
Expected an assignment or function call and instead saw an expression.eslint[@typescript-eslint/no-unused-expressions](https://typescript-eslint.io/rules/no-unused-expressions)
のエラーになっていたので、直しました🙏
katanaでもエラーになって修正を入れていたのでルール変わったのかな〜と思っていたのですが環境問題・・・??
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.
あー、なんか pnpm の何かがおかしいのか使い方間違ってるのか、 typescript-eslint のバージョンが v8 になったり v7 になったりすることあるんですよね…。僕の環境だけだと思ったけど普通に起こるのか。さっさと v8 に統一したい。
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.
↑ sandbox で使用してる ESLint 周りのバージョン差異のせいっぽかった。
のでこの変更がなくてもCIは通ると思うんですが、まぁ害はない変更だし、いずれは必要になる対応なので良さそう。
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.
👍️ 現バージョンでは Icon コンポーネントを RSC で利用できなかったのが、利用できるようになることを確認しました。
また、プロダクト側にインストールしてみて、特にデグレが検知されないことも確認しました。
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.
同じくIconがRSCとして使えることを確認しました! :arigatau:
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.
GoGo!
をマージしたので、masterを取り込むとちゃんとCIが落ちて Icon が使えるようになったことが検知できてるか確認していただけると助かります! |
え! Input/Checkbox/TextLink が RSC できる判定になってる! おもいっきり useEffect 使ってるけど、 |
別途判定方法を見直しますので、いったん CI 通るように |
関連URL
https://smarthr.atlassian.net/browse/SHRUI-1052
概要
各コンポーネントがuseThemeに依存していることで、React Server ComponentでSmartHR UIのコンポーネントを使用できない問題を解消したい。
変更内容
確認方法
use client
がなくてもエラーにならないことを確認するuse client
なしで実行できることを確認する