stufro / chordly

A free, open-source, online chord sheet creator
https://chordly.co.uk
GNU General Public License v3.0
28 stars 1 forks source link

fix: "previous versions" button failing after transpose #26

Closed Samuelodan closed 2 months ago

Samuelodan commented 2 months ago

this change stops the button from refreshing (or being replaced) and losing its event listener for opening the modal.

I found two other ways to fix this:

  1. wrapping the chord sheet content in a turbo frame and targeting that turbo frame from the "Previous versions" button.
  2. changing the transpose button to cause a full page reload. This one made the experience janky, so I didn't like it.

I'd like to hear your thoughts on the issue. I suspected the modal controller was getting disconnected after transposing, but that wasn't the case. The connection remained, but the button defaulted to sending a post request.

I also considered changing the button method to get, using a link, or even using a plain HTML button (no request will be sent) so it wouldn't cause the server error, but I don't know how useful that would be if the button's intended function weren't happening.

Lastly, I noticed the bug was a little different in prod. It looked like what you'd get if there were no matching turbo frame in the response. Still, I reckon that's better than the error in main.

Samuelodan commented 2 months ago

fixes #25

stufro commented 2 months ago

Thank you so much for fixing this! Looking at the options you described I think the one you picked is the best solution. I'll get this deployed asap. Thank youuuu :)

Samuelodan commented 2 months ago

Ah, I'm happy to hear you think so too. Thank you for the opportunity 😊