I’m playing around with Turbo frames using Rails. A TurboFrame can be lazy-loaded by using the src attribute. This is great, but what about auto-reloading a frame every few seconds?
I want to display a time series chart which needs to update itself. There is no server side event for doing a TurboStream broadcast. A simple polling mechanism is required. How can the frame reload itself?
Thanks, it seems that Turbo.visit() can load a frame, too. But it changes the URL in the address bar (pushes to history), so it does not help me yet. I’m looking for a way to fetch a frame and do the div replacement - nothing more.
Currently I’m trying to understand the Turbo sources…
This is cool, thanks for that. However, I couldn’t get it to continually poll, it just refreshes the turbo-frame once.
I want to poll a turbo-frame continually until a background job is finished, and then show the result (and stop polling). I don’t see how to make this work with turbo-frames, as it only replaces the contents, but does not update the attributes of the turbo-frame.
Is something like that possible with turbo-frames?