truechops / truechops

truechops-truechops.vercel.app
1 stars 1 forks source link

Render rhythm? #2

Closed ichionid closed 2 years ago

ichionid commented 2 years ago

https://github.com/truechops/truechops/blob/009c4083a8819f032bd88f611a08577e20710a64/src/store/services/mutate/types/raEmergentCycles.js#L28

Hey! I have finished a draft of the new mutation, however no matter what I have in notes, it simply denies to re-render. Is there a path in the flow you can see I am missing? :) @simonbytez any hints?

simonbytez commented 2 years ago

Hello sir! It's good to hear from you.

It's probably not re-rendering because the state is not being modified; instead, you are creating a new array with the concat method. So, the original state in memory has stayed the same. Thus, the score does not re-render.

As it modifies the original array, try using splice instead of concat: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice

HOWEVER, are you looking to add new measures? If so, you can't concat notes. The mutate function processes single measures at a time (to be precise, it processes modifiable notes in a measure as specified by the mutate grid), and if you concat notes, you will be adding to the measure being processed, and the measure will no longer be musically correct. Take a look at src/store/services/measure-service.js::addMeasure to see how new measures are currently being added. Notice that 'splice' is being called on state.score.measures. For a bigger picture view of the structure of the score object, take a look at src/consts/default-score.js.

But maybe I'm misreading the code and you are not looking to add new measures. LOL. Whatever the case, array.splice is in order.

By the way, I really appreciate your work so far. Specifically, I love the comments and care you are taking over the code!

Nobody is using the site right now. However, my brother is going to make a post about the site on his LinkedIn account, so maybe we will get some users! I've prayed for some good connections, so I know some are on the way :) I'm patient, though cause the site isn't going anywhere.

@ichionid

ichionid commented 2 years ago

Thanks for the reply Jared! Hit me up on Linkedin https://www.linkedin.com/in/giannis-chionidis-a4564726/ Thanks for the hints! I get the flow and will refer to your points. I tried to add new measures, not showing how exactly it'd play out hehe. From what I understand there might a chance to add measures through the measure-service, either this or I can define a similarity param so that the new measure has some kind of relationship with the one on the input.

I love the project, I literally have no time, kid+job+basketball coach+drumming+kid once more but I love the project and I'm very happy you keep in da loop even though I am coding here and then :) Cheers! Giannis

On Thu, 28 Oct 2021 at 02:30, Jared Simon @.***> wrote:

Hello sir! It's good to hear from you.

It's probably not re-rendering because the state is not being modified; instead, you are creating a new array with the concat method. So, the original state in memory has stayed the same. Thus, the score does not re-render.

As it modifies the original array, try using splice instead of concat: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice

HOWEVER, are you looking to add new measures? If so, you can't concat notes. The mutate function processes single measures at a time (to be precise, it processes modifiable notes in a measure as specified by the mutate grid), and if you concat notes, you will be adding to the measure being processed, and the measure will no longer be musically correct. Take a look at src/store/services/measure-service.js::addMeasure to see how new measures are currently being added. Notice that 'splice' is being called on state.score.measures. For a bigger picture view of the structure of the score object, take a look at src/consts/default-score.js.

But maybe I'm misreading the code and you are not looking to add new measures. LOL. Whatever the case, array.splice is in order.

By the way, I really appreciate your work so far. Specifically, I love the comments and care you are taking over the code!

Nobody is using the site right now. However, my brother is going to make a post about the site on his LinkedIn account, so maybe we will get some users! I've prayed for some good connections, so I know some are on the way :) I'm patient, though cause the site isn't going anywhere.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/truechops/truechops/issues/2#issuecomment-953406198, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHHCGE4R7XBLVCXTGO527LUJCKSHANCNFSM5GXWA5CA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.