Is setting turbo frame src in stimulus controller bad practice?

According to chat gpt:

Turbo Frames in Rails typically work by sending requests to the server, and the server responds with the updated content for the frame. If you’re manually updating the src attribute of a Turbo Frame and expecting it to reload, it might not work as expected because Turbo Frames rely on Turbo Streams to provide the updated content.

Turbo Frames rely on Turbo Streams to provide the updated content.

This is not correct.

Setting src attribute via JS to control a turbo frame is a standard practice.

3 Likes

thanks, I think in my case I blamed frame’ src set but the problem was that I still had turbolinks on :slight_smile:

You can set ‘src’ with JS, no problem. The “only” thing turbo does is intercept the form request and read from ‘src’ to realize where to send data. It doesnt matter if you change it a thousand times, it only cares about the attribute when the form is submitted!