Skip to content
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

refactor: store/audio.ts内の不要になっていたgetterを削除 #1580

Merged
merged 4 commits into from
Sep 30, 2023

Conversation

thiramisu
Copy link
Contributor

@thiramisu thiramisu commented Sep 24, 2023

内容

store/audio.ts内の不要になっていたgetter、HAVE_AUDIO_QUERYIS_ACTIVEを削除します。
ユーザー視点での変更はありません。

IS_ACTIVEは無くても一行で書けるので今後を考えても消して問題なさそうです。

HAVE_AUDIO_QUERYも一行で書けますし、大抵はquery.hogeって感じで続くので、一時的にconst query = state.audioItems[audioKey].query;みたいに書くのがさほど不自然ではなく、消しても問題ないかなと思いました。
ただquery .=で正規表現検索したところ、無い場合にエラーという処理が多かったので、もしかしたら

ENSURE_AUDIO_QUERY: {
  getter: (state) => (audioKey) => {
    const query = state.audioItems[audioKey].query;
    if (query == undefined) throw error;
    return query;
  }
}

みたいなのがあってもいいのかもです。

関連 Issue

その他

@thiramisu thiramisu requested a review from a team as a code owner September 24, 2023 04:06
@thiramisu thiramisu requested review from y-chan and removed request for a team September 24, 2023 04:06
Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

ENSURE_AUDIO_QUERY: {
みたいなのがあってもいいのかもです。

そういう関数があるの良さそうに感じました!
ENSURE_だとvalidateなどと同様にtrue/falseが帰ると想像されるかも・・・?
ChatGPT君的にはgetAudioQueryOrError辺りが良さそうかもです。

@Hiroshiba Hiroshiba merged commit 13edc43 into VOICEVOX:main Sep 30, 2023
@Hiroshiba Hiroshiba removed the request for review from y-chan September 30, 2023 06:24
@thiramisu thiramisu deleted the delete-disused-getters branch September 30, 2023 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants