Open coorasse opened 8 months ago
I think what would be interesting would be also to have a "frame_refreshes" kind of feature. Likewise the page_refreshes, but to signal clients that they should reload the frames.
@coorasse have you tried adding the refresh="morph"
attribute on to your Turbo Frame? It looks like it is reloaded with a morph if it has that attribute:
Here's the relevant commit with a message describing the feature: https://github.com/hotwired/turbo/commit/9ff6e16da631f5d58d467bceea7e42e40df02a3a
@coorasse and @willcosgrove I have this same issue, and I tried the solution that you proposed, Will. Unfortunately, it doesn't work. Specifically, I put refresh="morph" on my frame and then use a link to trigger: <a onclick="document.getElementById('frame').reload(); return false;" href="#">reload frame</a>
and the frame reloads but it still re-writes the whole thing.
Based on reading the PR and testing it, it only does a morph of the frame when the full page is doing a morphing refresh. I just asked a clarifying question on the PR to see if this was an oversight: https://github.com/hotwired/turbo/pull/1068
In the meantime, I'm hunting for a workaround...
Now that #1192 has been merged and FrameElement.reload()
will utilize morphing when the [refresh="morph"]
attribute is set, can this issue be resolved?
I have some turbo frames that are eager/lazy loaded (i.e. they have a
src
attribute). These frames can be reloaded. The "problem" is that I cannot replace the content using idiomorph, but the frame content is always swapped with a new one. I believe this is intentional or not planned at the moment, but I'd like to know if this is something that can/should be achieved differently. Our need is basically to keep the "reloading" mechanism, but be able to swap the content using idiomorph.