We started using Hotwire in our new project and we’re loving it!
There’s an issue we’re currently having with Turbo, where Turbo Stream append only works at the first click. We have a donation.html page where the user can add fields via Turbo streams.
After the user clicks on the button, Turbo frame changes and adds a src to it:
turbo-frame#donation-rows src="<URI>"
This prevents that the button can be clicked more often, if the user decides to add more fields. We could of course delete the src it adds with JavaScript but we’d like to refrain from doing so.
Is there something that we’re doing wrong or do we need to apply some changes to the code in order for it to work?
I am curious how you got the src in the turbo frame tag to change once a user presses the button. I am using turbo frame tag: <%= turbo_frame_tag “car_show”, src: “http://localhost:3000/cars/bmw” %> and I have a stimulus controller pulling the URL of a car in the partial that is clicked on. How are you changing the src when a user clicks?
My turbo frame doesn’t have an src initially, only the id=“donation_rows”. Whenever I click on the button, the src gets appended to the turbo frame. When I remove the added src, it works and one more field gets added.
As of right now, I don’t have anything that alters the src. I haven’t used turbo_frame_tag but I’ll definitely have a look at it and set up a stimulus controller if I don’t find a fix for it.