-
Notifications
You must be signed in to change notification settings - Fork 289
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
singing.tsのsearchPhrasesをリファクタリング #1850
The head ref may contain hidden characters: "serchPhrases\u306E\u30EA\u30D5\u30A1\u30AF\u30BF\u30EA\u30F3\u30B0"
Conversation
|
動作確認してみました。 oss.mp4 |
@@ -855,9 +855,11 @@ export const singingStore = createPartialStore<SingingStoreTypes>({ | |||
phraseNotes.push(note); | |||
|
|||
const currentNoteEnd = note.position + note.duration; | |||
const nextNoteStart = notes[noteIndex + 1].position; | |||
const nextNoteStart = | |||
noteIndex + 1 < notes.length ? notes[noteIndex + 1].position : null; | |||
if ( | |||
noteIndex === notes.length - 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.
if( noteIndex === notes.length - 1 ||
note.position + note.duration !== notes[noteIndex + 1].position)
↑このように書くと、notes[noteIndex + 1]
が存在しない場合も、条件が通るので、nextNoteStart == null
と明示する形にしました。
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です!!
レビューを参考に具体例をちょっと書いてみました。 |
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!!
ちょっと細かい部分こちらで変更させていただきます!
) { | ||
const phraseFirstNote = phraseNotes[0]; | ||
const phraseLastNote = phraseNotes[phraseNotes.length - 1]; | ||
const hash = await generatePhraseHash({ | ||
const params = { |
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.
「generate params」だとパラメータを作るという意味になってしまうので、単純にparamsにしてみました!
マージします! またよければリファクタリングに挑戦してみてください!! |
内容
題の通りです。
singing.tsのRENDERが結構複雑みたいなので、小出しでリファクタリングできればと思っています。
関連issue