-
Notifications
You must be signed in to change notification settings - Fork 1
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
フロントエンドのデータ取得の流れを整備 #476
フロントエンドのデータ取得の流れを整備 #476
Conversation
The latest Buf updates on your PR. Results from workflow Proto CI Pipeline / breaking (pull_request).
|
8eaeeb6
to
436d4f8
Compare
const transport = createConnectTransport({ | ||
baseUrl: "/api", | ||
}); |
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.
とりあえず/api
の下にバックエンドがありそこに Connect Protocol でアクセスするということにする
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.
本番環境でもそのようにする予定
ワンチャン/connect
と/api
で分けるかも
(ファイル関係はConnectだとキツいので、一応OpenAPIを書いていて、それのパスを/api
として切り分けるのであればConnectと混ぜるのは微妙かなぁという悩みがある)
export const connect = { | ||
rpc: <M extends DescMethod>( | ||
method: M, | ||
impl: MethodImpl<M>, | ||
options?: ConnectHandlerOptions, | ||
) => | ||
new ConnectHandler( | ||
{ kind: method.kind, name: `${method.parent.typeName}/${method.name}` }, | ||
(router) => router.rpc(method, impl), | ||
options, | ||
), | ||
service: <S extends DescService>( | ||
service: S, | ||
impl: ServiceImpl<S>, | ||
options?: ConnectHandlerOptions, | ||
) => | ||
new ConnectHandler( | ||
{ kind: "service", name: service.typeName }, | ||
(router) => router.service(service, impl), | ||
options, | ||
), | ||
}; |
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.
[zatsu] なぜかなくて人々が困っている様子が見える(connectrpc/connect-es#825) のでライブラリとして外に切り出してもいいかもね
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.
自分のリポジトリで公開して、それを利用する形にしてしまって良いのでは
ICTSCとしては全然OKですよ
<> | ||
<AppShell> | ||
<AppShell me={me}> |
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.
常にme
を引き回すかは怪しい。Context にするかも
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.
データのライフサイクル管理・フェッチタイミング管理も視野に入れて決めてもらえればという感じ
"@connectrpc/connect": "2.0.0-alpha.1", | ||
"@connectrpc/connect-web": "2.0.0-alpha.1", |
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.
これを実用する頃には beta にはなっているだろうという読み。なっててくれ
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.
フロントエンドにわかだけど、自分がみた感じ問題なさそうです
大感謝
問題とかの他のデータも合わさってきた時に、異なるライフサイクル・フェッチタイミングのデータが混在してくると思うから、それを統一的に管理できるとわかりやすくて嬉しいかも...という思いがあります
(そこに関してもお任せしますが)
@@ -36,3 +36,25 @@ jobs: | |||
|
|||
- name: Lint | |||
run: pnpm run --recursive --parallel --aggregate-output lint | |||
test: |
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で確認するようなイメージがあるんだけど、それはなくても大丈夫?
export const connect = { | ||
rpc: <M extends DescMethod>( | ||
method: M, | ||
impl: MethodImpl<M>, | ||
options?: ConnectHandlerOptions, | ||
) => | ||
new ConnectHandler( | ||
{ kind: method.kind, name: `${method.parent.typeName}/${method.name}` }, | ||
(router) => router.rpc(method, impl), | ||
options, | ||
), | ||
service: <S extends DescService>( | ||
service: S, | ||
impl: ServiceImpl<S>, | ||
options?: ConnectHandlerOptions, | ||
) => | ||
new ConnectHandler( | ||
{ kind: "service", name: service.typeName }, | ||
(router) => router.service(service, impl), | ||
options, | ||
), | ||
}; |
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.
自分のリポジトリで公開して、それを利用する形にしてしまって良いのでは
ICTSCとしては全然OKですよ
const transport = createConnectTransport({ | ||
baseUrl: "/api", | ||
}); |
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.
本番環境でもそのようにする予定
ワンチャン/connect
と/api
で分けるかも
(ファイル関係はConnectだとキツいので、一応OpenAPIを書いていて、それのパスを/api
として切り分けるのであればConnectと混ぜるのは微妙かなぁという悩みがある)
<> | ||
<AppShell> | ||
<AppShell me={me}> |
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.
データのライフサイクル管理・フェッチタイミング管理も視野に入れて決めてもらえればという感じ
モジュール関係のコンフリクト直したらセルフマージで大丈夫です |
e1acc98
to
0149418
Compare
これにより
pnpm dev
で動かなくなる(エラーが表示される)が仕様(API がないので)