-
Notifications
You must be signed in to change notification settings - Fork 312
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
Change: ブラウザ版のConfigをBaseConfigManagerベースに #1629
Conversation
fc50e9f
to
ff3f473
Compare
Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
sed -i -e 's|"074fc39e-678b-4c13-8916-ffca8d505d1d"|"208cf94d-43d2-4cf5-abc0-9783cac36d29"|' .env.test | ||
sed -i -e 's|"../voicevox_engine/run.exe"|"${{ steps.download-engine.outputs.run_path }}"|' .env.test | ||
sed -i -e 's|"executionArgs": \[\],|"executionArgs": ["--port=50021"],|' .env.test | ||
cp .env.test .env | ||
sed -i -e 's|"../voicevox_engine/run.exe"|"${{ steps.download-engine.outputs.run_path }}"|' .env | ||
sed -i -e 's|"executionArgs": \[\],|"executionArgs": ["--port=50021"],|' .env |
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.
あ、このあたりも必要な変更だった感じでしょうか 👀
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.
色々試してたときのやつですね。問題自体はここには無かったのでいらないっちゃ要らないはず。
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.
なるほどです!
エンジンIDの変更が意図的かどうかパッとわからないので、やったほうが良さそうであればエンジンリポジトリと同様に環境変数へ、なくても良さそうであればこの行を消すはどうでしょう?
.env.test
を書き換えるかはどちらでも良さそう。
(どっちかというと.envを自由に書き換えるほうがローカル変数っぽみがあって直感的だとは思います。.env.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.
Viteは.env
より.env.test
の方が優先度が高いので、.env
と.env.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.
あ、たしかに!!気をつけないといけない仕様ですね・・・。
(だとしたらexecutionArgs
が元の.env.testの空っぽのに上書きされてそうですけど、なんで今まで動いてたんだろう)
.env.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.
お疲れ様でした!!!
非常に有用なプルリクエストだと思います!!
ちょっとコーディング周りや設計周りでいろいろコメントさせていただきました。
よくわからなかったら言っていただければ 🙏
もしよければ @yamachu さんも見て頂けると心強いです!!
src/browser/storeImpl.ts
Outdated
async afterInitialize() { | ||
if (this.config == null) { | ||
throw new Error("assert: config != null"); | ||
} | ||
this.config.engineSettings[defaultEngineId] ??= engineSettingSchema.parse( | ||
{} | ||
); | ||
} |
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.
onupgradeneededに書くとconfigの初期化周りで処理が重複しそうだったのでフックを用意してそこに書きました。名前は変えても良いかも。
Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
lockでいい感じに書き直してみました。 |
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.
ほぼLGTMです!!!
バックエンドが異なる共通部分の設計、難しいですね。。。。。。 😇
src/browser/storeImpl.ts
Outdated
export async function withConfigManager<T>( | ||
callback: (configManager: BrowserConfigManager) => Promise<T> | ||
): Promise<T> { |
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.
ここはどうしてもelectron側と実装が異なるので複雑性を1段階回すことになってしまうことに気づきました。
以下共有用メモです。
この辺り見てたんですが、
electron側はgetConfigManagerがasyncじゃなくて良い一方、
browser側はgetConfigManagerがasyncになる必要がありそうでした。
根本の課題は起動シーケンスの違いで、electronはバックエンドが最初なのに対し、browserはフロントエンドが最初なのでConfigManager初期化のタイミングがないんですよね・・・。
仮にバックエンドを初期化する関数を用意しても、Vueを初期化する前だとawaitできない・・・。
レビューを反映しました。 |
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.
LGTM!!!
コメント追加もありがとうございました!
テストが落ちていたのでrerunしてみました。また落ちるようでしたら再review requestいただけると・・・!
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.
LGTM!!!
お疲れ様でした!!!
@yamachu さんもレビューありがとうございました! |
内容
タイトル通り。
関連 Issue
スクリーンショット・動画など
(なし)
その他
(なし)