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

feat: [project-sequencer-statemachine] 初期ステートの設定周りを変更 #2518

Conversation

sigprogramming
Copy link
Contributor

@sigprogramming sigprogramming commented Feb 2, 2025

内容

初期ステートをIDで指定する形に変更して、useSequencerStateMachineする際に指定できるようにします。
(デフォルト値を無くす)

また、以下も行います。

  • StateMachineにdisposeメソッドを追加
    • disposeが呼ばれた際に現在のステートのonExitが呼ばれるようにする
  • StateMachineにtransitionToメソッドを追加
  • コメントの空行を削除

関連 Issue

その他

@voicevox-preview-pages
Copy link

🚀 プレビュー用ページを作成しました 🚀

更新時点でのコミットハッシュ:ba6ac9a

src/sing/stateMachine.ts Outdated Show resolved Hide resolved
src/sing/stateMachine.ts Outdated Show resolved Hide resolved
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!!

ちょっと一箇所変えさせていただこうと思います!

PR内容にコメントの空行を削除とあったのですが、 95e6085 で元に戻ってそうでした!
どっちが意図した変更なのかわからないですが、とりあえず今はプルリクエストの前と実装が変わってない状態なので一旦良さそう。
意図していなかった場合は後で変えていただければ・・・!

ちなみに空行を追加するか消すかのコメントスタイルはどっちでも良さそうですが、コード全体で統一されてることは大事だと思います!
個人的には・・・改行なくても全然見やすそう&一覧性が上がりそう!

まあそもそも@paramがなくてもわかるような引数名にすればいい気がします!
どうしてもわからないのだけコメントを書く感じとかでも。
例えばtransitionTo@param id 遷移先のステートのID。とかは、stateIdという引数名にすればかなり自明かなと。
(これの場合は型でStateIdだと分かってるので、idのままでも良さそう。)

@@ -91,6 +91,15 @@ type StateFactories<T extends StateDefinition[], Input, Context> = {
) => State<T, Input, Context> & { readonly id: U };
};

/**
* 初期ステートとして設定可能なステートのIDを表す型。
Copy link
Member

@Hiroshiba Hiroshiba Feb 3, 2025

Choose a reason for hiding this comment

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

「設定可能なステートのID」と書いていて1つの ID ではないことがわかるので、「表す型」は自明かも。

Suggested change
* 初期ステートとして設定可能なステートのIDを表す型
* 初期ステートとして設定可能なステートのID

だけど他の定義にはそう書いてあるので、ここは書いた方が良さそう!
変えるなら全部変えた方が良さそう。

src/sing/stateMachine.ts Outdated Show resolved Hide resolved
@Hiroshiba Hiroshiba changed the title [project-sequencer-statemachine] 初期ステートの設定周りを変更 feat: [project-sequencer-statemachine] 初期ステートの設定周りを変更 Feb 3, 2025
@Hiroshiba Hiroshiba merged commit 4205802 into VOICEVOX:project-sequencer-statemachine Feb 3, 2025
10 checks passed
@sigprogramming sigprogramming deleted the change_initial_value_to_be_given_from_outside branch February 4, 2025 12:25
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