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

[project-sequencer-statemachine] ステートのインスタンスの作成をファクトリ関数で行うようにする #2500

Conversation

sigprogramming
Copy link
Contributor

内容

ステートのインスタンスの作成をファクトリ関数で行うようにします。
(ステートの中で他のステートのインスタンスの作成を行わないようにします)

関連 Issue

その他

@sigprogramming sigprogramming requested a review from a team as a code owner January 22, 2025 12:47
@sigprogramming sigprogramming requested review from Hiroshiba and removed request for a team January 22, 2025 12:47
@voicevox-preview-pages
Copy link

voicevox-preview-pages bot commented Jan 22, 2025

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

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

Comment on lines 87 to 107
type PartialStore = {
state: {
tpqn: number;
sequencerSnapType: number;
sequencerEditTarget: SequencerEditTarget;
editorFrameRate: number;
};
getters: {
SELECTED_TRACK_ID: TrackId;
SELECTED_TRACK: Track;
SELECTED_NOTE_IDS: Set<NoteId>;
};
actions: {
SELECT_NOTES: (payload: { noteIds: NoteId[] }) => Promise<void>;
DESELECT_NOTES: (payload: { noteIds: NoteId[] }) => Promise<void>;
DESELECT_ALL_NOTES: () => Promise<void>;
PLAY_PREVIEW_SOUND: (payload: {
noteNumber: number;
duration?: number;
}) => Promise<void>;
COMMAND_ADD_NOTES: (payload: {
notes: Note[];
trackId: TrackId;
}) => Promise<void>;
COMMAND_UPDATE_NOTES: (payload: {
notes: Note[];
trackId: TrackId;
}) => Promise<void>;
COMMAND_SET_PITCH_EDIT_DATA: (payload: {
pitchArray: number[];
startFrame: number;
trackId: TrackId;
}) => Promise<void>;
COMMAND_ERASE_PITCH_EDIT_DATA: (payload: {
startFrame: number;
frameLength: number;
trackId: TrackId;
}) => Promise<void>;
};
state: Pick<
Store["state"],
"tpqn" | "sequencerSnapType" | "sequencerEditTarget" | "editorFrameRate"
>;
getters: Pick<
Store["getters"],
"SELECTED_TRACK_ID" | "SELECTED_TRACK" | "SELECTED_NOTE_IDS"
>;
actions: Pick<
Store["actions"],
| "SELECT_NOTES"
| "DESELECT_NOTES"
| "DESELECT_ALL_NOTES"
| "PLAY_PREVIEW_SOUND"
| "COMMAND_ADD_NOTES"
| "COMMAND_UPDATE_NOTES"
| "COMMAND_SET_PITCH_EDIT_DATA"
| "COMMAND_ERASE_PITCH_EDIT_DATA"
>;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

StoreからPickするようにしました。

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です!!型サポートがちゃんとできてて便利そう!

名前だけいくつか提案しました!

typescriptの型周りの設計をどうすれば良いかの知見がない中でいくつか提案コメントもしてみました 🙇
もし共感あれば、みたいな気持ちです・・・!!

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

型サポートをいい感じに受けつつ、かつ定義をそこまでややこしくないので良さそう!!!

@Hiroshiba Hiroshiba merged commit 2779fbe into VOICEVOX:project-sequencer-statemachine Jan 23, 2025
10 checks passed
@sigprogramming sigprogramming deleted the adjust_state_types branch January 24, 2025 13:14
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