fix: "previous versions" button failing after transpose #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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.