marcoroth / turbo_power-rails

Power-pack for Turbo Streams

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

turbo_frame_reload changes the src of the frame?

DaveSanders opened this issue · comments

I tripped across this today, but not sure if this is by design / unavoidable in turbo, or a bug?

I have a turbo frame with a src like:

<turbo-frame id="blah" src="/blah/1">

in my rails controller, on another action (let's say I'm editing blah) I tell it to reload that frame:

#blah_controller

def edit
  #do stuff
  render turbo_stream: turbo_stream.turbo_frame_reload('blah')
end

Then the turbo frame src of the frame I'm reloading changes to:

<turbo-rame id="blah" src="/blah/1/edit">

which is incorrect, the src should stay the same.

Is this intentional, or due to some side effect of Turbo reloading? IMO, the src of a turbo frame should never change. And its causing unexpected issues in my app because of the url its putting there.

This might be some other issue in my app, I'm seeing some REALLY weird turbo behavior so I'm going to clean up some code and verify that the above really is happening the way I think it is.

Sigh, yeah, this is turbo behavior inside a frame where my button to the edit action is replacing the url of the src in the turbo frame. Not a fault of turbo power. Closing the issue

Hey @DaveSanders, thanks for reaching out. I'm glad you figured it out!

If there's anything I can do to improve this expierience within Turbo Power let me know! I'd love to make this as seamless as possible!